diff --git a/crates/rome_js_analyze/src/analyzers/style/use_single_var_declarator.rs b/crates/rome_js_analyze/src/analyzers/style/use_single_var_declarator.rs index 325db4d57f9..1142dce4234 100644 --- a/crates/rome_js_analyze/src/analyzers/style/use_single_var_declarator.rs +++ b/crates/rome_js_analyze/src/analyzers/style/use_single_var_declarator.rs @@ -52,7 +52,11 @@ impl Rule for UseSingleVarDeclarator { semicolon_token, } = node.as_fields(); - let JsVariableDeclarationFields { kind, declarators } = declaration.ok()?.as_fields(); + let JsVariableDeclarationFields { + await_token: _, + kind, + declarators, + } = declaration.ok()?.as_fields(); let kind = kind.ok()?; @@ -194,10 +198,13 @@ impl Rule for UseSingleVarDeclarator { ) }; - let mut builder = make::js_variable_statement(make::js_variable_declaration( - kind, - make::js_variable_declarator_list([declarator], []), - )); + let mut builder = make::js_variable_statement( + make::js_variable_declaration( + kind, + make::js_variable_declarator_list([declarator], []), + ) + .build(), + ); let semicolon_token = if index + 1 == declarators_len { last_semicolon_token diff --git a/crates/rome_js_factory/src/generated/node_factory.rs b/crates/rome_js_factory/src/generated/node_factory.rs index 0c1fd482c6e..86f7cfc62d0 100644 --- a/crates/rome_js_factory/src/generated/node_factory.rs +++ b/crates/rome_js_factory/src/generated/node_factory.rs @@ -1485,14 +1485,33 @@ impl JsForStatementBuilder { pub fn js_for_variable_declaration( kind_token_token: SyntaxToken, declarator: JsVariableDeclarator, -) -> JsForVariableDeclaration { - JsForVariableDeclaration::unwrap_cast(SyntaxNode::new_detached( - JsSyntaxKind::JS_FOR_VARIABLE_DECLARATION, - [ - Some(SyntaxElement::Token(kind_token_token)), - Some(SyntaxElement::Node(declarator.into_syntax())), - ], - )) +) -> JsForVariableDeclarationBuilder { + JsForVariableDeclarationBuilder { + kind_token_token, + declarator, + await_token: None, + } +} +pub struct JsForVariableDeclarationBuilder { + kind_token_token: SyntaxToken, + declarator: JsVariableDeclarator, + await_token: Option, +} +impl JsForVariableDeclarationBuilder { + pub fn with_await_token(mut self, await_token: SyntaxToken) -> Self { + self.await_token = Some(await_token); + self + } + pub fn build(self) -> JsForVariableDeclaration { + JsForVariableDeclaration::unwrap_cast(SyntaxNode::new_detached( + JsSyntaxKind::JS_FOR_VARIABLE_DECLARATION, + [ + self.await_token.map(|token| SyntaxElement::Token(token)), + Some(SyntaxElement::Token(self.kind_token_token)), + Some(SyntaxElement::Node(self.declarator.into_syntax())), + ], + )) + } } pub fn js_formal_parameter( decorators: JsDecoratorList, @@ -3377,14 +3396,33 @@ pub fn js_unary_expression( pub fn js_variable_declaration( kind_token: SyntaxToken, declarators: JsVariableDeclaratorList, -) -> JsVariableDeclaration { - JsVariableDeclaration::unwrap_cast(SyntaxNode::new_detached( - JsSyntaxKind::JS_VARIABLE_DECLARATION, - [ - Some(SyntaxElement::Token(kind_token)), - Some(SyntaxElement::Node(declarators.into_syntax())), - ], - )) +) -> JsVariableDeclarationBuilder { + JsVariableDeclarationBuilder { + kind_token, + declarators, + await_token: None, + } +} +pub struct JsVariableDeclarationBuilder { + kind_token: SyntaxToken, + declarators: JsVariableDeclaratorList, + await_token: Option, +} +impl JsVariableDeclarationBuilder { + pub fn with_await_token(mut self, await_token: SyntaxToken) -> Self { + self.await_token = Some(await_token); + self + } + pub fn build(self) -> JsVariableDeclaration { + JsVariableDeclaration::unwrap_cast(SyntaxNode::new_detached( + JsSyntaxKind::JS_VARIABLE_DECLARATION, + [ + self.await_token.map(|token| SyntaxElement::Token(token)), + Some(SyntaxElement::Token(self.kind_token)), + Some(SyntaxElement::Node(self.declarators.into_syntax())), + ], + )) + } } pub fn js_variable_declaration_clause( declaration: JsVariableDeclaration, diff --git a/crates/rome_js_factory/src/generated/syntax_factory.rs b/crates/rome_js_factory/src/generated/syntax_factory.rs index 24895a7f654..49e0fbd3de3 100644 --- a/crates/rome_js_factory/src/generated/syntax_factory.rs +++ b/crates/rome_js_factory/src/generated/syntax_factory.rs @@ -2237,10 +2237,17 @@ impl SyntaxFactory for JsSyntaxFactory { } JS_FOR_VARIABLE_DECLARATION => { let mut elements = (&children).into_iter(); - let mut slots: RawNodeSlots<2usize> = RawNodeSlots::default(); + let mut slots: RawNodeSlots<3usize> = RawNodeSlots::default(); let mut current_element = elements.next(); if let Some(element) = ¤t_element { - if matches!(element.kind(), T![var] | T![let] | T![const]) { + if element.kind() == T![await] { + slots.mark_present(); + current_element = elements.next(); + } + } + slots.next_slot(); + if let Some(element) = ¤t_element { + if matches!(element.kind(), T![var] | T![let] | T![const] | T![using]) { slots.mark_present(); current_element = elements.next(); } @@ -5173,10 +5180,17 @@ impl SyntaxFactory for JsSyntaxFactory { } JS_VARIABLE_DECLARATION => { let mut elements = (&children).into_iter(); - let mut slots: RawNodeSlots<2usize> = RawNodeSlots::default(); + let mut slots: RawNodeSlots<3usize> = RawNodeSlots::default(); let mut current_element = elements.next(); if let Some(element) = ¤t_element { - if matches!(element.kind(), T![var] | T![const] | T![let]) { + if element.kind() == T![await] { + slots.mark_present(); + current_element = elements.next(); + } + } + slots.next_slot(); + if let Some(element) = ¤t_element { + if matches!(element.kind(), T![var] | T![const] | T![let] | T![using]) { slots.mark_present(); current_element = elements.next(); } diff --git a/crates/rome_js_formatter/src/js/declarations/for_variable_declaration.rs b/crates/rome_js_formatter/src/js/declarations/for_variable_declaration.rs index d6db4bfdfd8..eb9134018ff 100644 --- a/crates/rome_js_formatter/src/js/declarations/for_variable_declaration.rs +++ b/crates/rome_js_formatter/src/js/declarations/for_variable_declaration.rs @@ -10,17 +10,31 @@ pub(crate) struct FormatJsForVariableDeclaration; impl FormatNodeRule for FormatJsForVariableDeclaration { fn fmt_fields(&self, node: &JsForVariableDeclaration, f: &mut JsFormatter) -> FormatResult<()> { let JsForVariableDeclarationFields { + await_token, kind_token, declarator, } = node.as_fields(); - write![ - f, - [group(&format_args![ - kind_token.format(), - space(), - declarator.format() - ])] - ] + if let Some(await_token) = await_token { + write![ + f, + [group(&format_args![ + await_token.format(), + space(), + kind_token.format(), + space(), + declarator.format() + ])] + ] + } else { + write![ + f, + [group(&format_args![ + kind_token.format(), + space(), + declarator.format() + ])] + ] + } } } diff --git a/crates/rome_js_formatter/src/js/declarations/variable_declaration.rs b/crates/rome_js_formatter/src/js/declarations/variable_declaration.rs index 69dec656322..0741b3bae70 100644 --- a/crates/rome_js_formatter/src/js/declarations/variable_declaration.rs +++ b/crates/rome_js_formatter/src/js/declarations/variable_declaration.rs @@ -9,15 +9,32 @@ pub(crate) struct FormatJsVariableDeclaration; impl FormatNodeRule for FormatJsVariableDeclaration { fn fmt_fields(&self, node: &JsVariableDeclaration, f: &mut JsFormatter) -> FormatResult<()> { - let JsVariableDeclarationFields { kind, declarators } = node.as_fields(); + let JsVariableDeclarationFields { + await_token, + kind, + declarators, + } = node.as_fields(); - write!( - f, - [group(&format_args![ - kind.format(), - space(), - declarators.format() - ])] - ) + if let Some(await_token) = await_token { + write![ + f, + [group(&format_args![ + await_token.format(), + space(), + kind.format(), + space(), + declarators.format() + ])] + ] + } else { + write![ + f, + [group(&format_args![ + kind.format(), + space(), + declarators.format() + ])] + ] + } } } diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/explicit-resource-management.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/explicit-resource-management.js.snap deleted file mode 100644 index 039438e44a4..00000000000 --- a/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/explicit-resource-management.js.snap +++ /dev/null @@ -1,154 +0,0 @@ ---- -source: crates/rome_formatter_test/src/snapshot_builder.rs -info: js/babel-plugins/explicit-resource-management.js ---- - -# Input - -```js -function * g() { - using handle = acquireFileHandle(); // block-scoped critical resource -} // cleanup - -{ - using obj = g(); // block-scoped declaration - const r = obj.next(); -} // calls finally blocks in `g` - -{ - await using obj = g(); -} - -``` - - -# Prettier differences - -```diff ---- Prettier -+++ Rome -@@ -1,12 +1,15 @@ - function* g() { -- using handle = acquireFileHandle(); // block-scoped critical resource -+ using; -+ handle = acquireFileHandle(); // block-scoped critical resource - } // cleanup - - { -- using obj = g(); // block-scoped declaration -+ using; -+ obj = g(); // block-scoped declaration - const r = obj.next(); - } // calls finally blocks in `g` - - { -- await using obj = g(); -+ await using; -+ obj = g(); - } -``` - -# Output - -```js -function* g() { - using; - handle = acquireFileHandle(); // block-scoped critical resource -} // cleanup - -{ - using; - obj = g(); // block-scoped declaration - const r = obj.next(); -} // calls finally blocks in `g` - -{ - await using; - obj = g(); -} -``` - -# Errors -``` -explicit-resource-management.js:2:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a semicolon or an implicit semicolon after a statement, but found none - - 1 │ function * g() { - > 2 │ using handle = acquireFileHandle(); // block-scoped critical resource - │ ^^^^^^ - 3 │ } // cleanup - 4 │ - - i An explicit or implicit semicolon is expected here... - - 1 │ function * g() { - > 2 │ using handle = acquireFileHandle(); // block-scoped critical resource - │ ^^^^^^ - 3 │ } // cleanup - 4 │ - - i ...Which is required to end this statement - - 1 │ function * g() { - > 2 │ using handle = acquireFileHandle(); // block-scoped critical resource - │ ^^^^^^^^^^^^ - 3 │ } // cleanup - 4 │ - -explicit-resource-management.js:6:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a semicolon or an implicit semicolon after a statement, but found none - - 5 │ { - > 6 │ using obj = g(); // block-scoped declaration - │ ^^^ - 7 │ const r = obj.next(); - 8 │ } // calls finally blocks in `g` - - i An explicit or implicit semicolon is expected here... - - 5 │ { - > 6 │ using obj = g(); // block-scoped declaration - │ ^^^ - 7 │ const r = obj.next(); - 8 │ } // calls finally blocks in `g` - - i ...Which is required to end this statement - - 5 │ { - > 6 │ using obj = g(); // block-scoped declaration - │ ^^^^^^^^^ - 7 │ const r = obj.next(); - 8 │ } // calls finally blocks in `g` - -explicit-resource-management.js:11:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a semicolon or an implicit semicolon after a statement, but found none - - 10 │ { - > 11 │ await using obj = g(); - │ ^^^ - 12 │ } - 13 │ - - i An explicit or implicit semicolon is expected here... - - 10 │ { - > 11 │ await using obj = g(); - │ ^^^ - 12 │ } - 13 │ - - i ...Which is required to end this statement - - 10 │ { - > 11 │ await using obj = g(); - │ ^^^^^^^^^^^^^^^ - 12 │ } - 13 │ - - -``` - - diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/explicit-resource-management/for-await-using-of-comments.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/explicit-resource-management/for-await-using-of-comments.js.snap deleted file mode 100644 index 8c921795939..00000000000 --- a/crates/rome_js_formatter/tests/specs/prettier/js/explicit-resource-management/for-await-using-of-comments.js.snap +++ /dev/null @@ -1,121 +0,0 @@ ---- -source: crates/rome_formatter_test/src/snapshot_builder.rs -info: js/explicit-resource-management/for-await-using-of-comments.js ---- - -# Input - -```js -/*1*/ for /* 2 */ await /*3*/ ( /*4*/ using /*5*/ fo /*6*/ of /*7*/ of /*8*/) /*9*/; - -``` - - -# Prettier differences - -```diff ---- Prettier -+++ Rome -@@ -1 +1,2 @@ --/*1*/ for await (/* 2 */ /*3*/ /*4*/ using /*5*/ fo /*6*/ of /*7*/ of /*8*/ /*9*/); -+/*1*/ for /* 2 */ await /*3*/ ( /*4*/ using /*5*/ fo /*6*/ of /*7*/ of /*8*/ -+) /*9*/ -``` - -# Output - -```js -/*1*/ for /* 2 */ await /*3*/ ( /*4*/ using /*5*/ fo /*6*/ of /*7*/ of /*8*/ -) /*9*/ -``` - -# Errors -``` -for-await-using-of-comments.js:1:51 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `;` but instead found `fo` - - > 1 │ /*1*/ for /* 2 */ await /*3*/ ( /*4*/ using /*5*/ fo /*6*/ of /*7*/ of /*8*/) /*9*/; - │ ^^ - 2 │ - - i Remove fo - -for-await-using-of-comments.js:1:60 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `;` but instead found `of` - - > 1 │ /*1*/ for /* 2 */ await /*3*/ ( /*4*/ using /*5*/ fo /*6*/ of /*7*/ of /*8*/) /*9*/; - │ ^^ - 2 │ - - i Remove of - -for-await-using-of-comments.js:1:69 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `)` but instead found `of` - - > 1 │ /*1*/ for /* 2 */ await /*3*/ ( /*4*/ using /*5*/ fo /*6*/ of /*7*/ of /*8*/) /*9*/; - │ ^^ - 2 │ - - i Remove of - -for-await-using-of-comments.js:1:77 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a semicolon or an implicit semicolon after a statement, but found none - - > 1 │ /*1*/ for /* 2 */ await /*3*/ ( /*4*/ using /*5*/ fo /*6*/ of /*7*/ of /*8*/) /*9*/; - │ ^ - 2 │ - - i An explicit or implicit semicolon is expected here... - - > 1 │ /*1*/ for /* 2 */ await /*3*/ ( /*4*/ using /*5*/ fo /*6*/ of /*7*/ of /*8*/) /*9*/; - │ ^ - 2 │ - - i ...Which is required to end this statement - - > 1 │ /*1*/ for /* 2 */ await /*3*/ ( /*4*/ using /*5*/ fo /*6*/ of /*7*/ of /*8*/) /*9*/; - │ ^^^^^^^^^ - 2 │ - -for-await-using-of-comments.js:1:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × await can only be used in conjunction with `for...of` statements - - > 1 │ /*1*/ for /* 2 */ await /*3*/ ( /*4*/ using /*5*/ fo /*6*/ of /*7*/ of /*8*/) /*9*/; - │ ^^^^^ - 2 │ - - i Remove the await here - - > 1 │ /*1*/ for /* 2 */ await /*3*/ ( /*4*/ using /*5*/ fo /*6*/ of /*7*/ of /*8*/) /*9*/; - │ ^^^^^ - 2 │ - - i or convert this to a `for...of` statement - - > 1 │ /*1*/ for /* 2 */ await /*3*/ ( /*4*/ using /*5*/ fo /*6*/ of /*7*/ of /*8*/) /*9*/; - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - 2 │ - -for-await-using-of-comments.js:1:77 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected a statement but instead found ')' - - > 1 │ /*1*/ for /* 2 */ await /*3*/ ( /*4*/ using /*5*/ fo /*6*/ of /*7*/ of /*8*/) /*9*/; - │ ^ - 2 │ - - i Expected a statement here - - > 1 │ /*1*/ for /* 2 */ await /*3*/ ( /*4*/ using /*5*/ fo /*6*/ of /*7*/ of /*8*/) /*9*/; - │ ^ - 2 │ - - -``` - - diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/explicit-resource-management/invalid-duplicate-using-bindings.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/explicit-resource-management/invalid-duplicate-using-bindings.js.snap deleted file mode 100644 index 5668a7e595d..00000000000 --- a/crates/rome_js_formatter/tests/specs/prettier/js/explicit-resource-management/invalid-duplicate-using-bindings.js.snap +++ /dev/null @@ -1,146 +0,0 @@ ---- -source: crates/rome_formatter_test/src/snapshot_builder.rs -info: js/explicit-resource-management/invalid-duplicate-using-bindings.js ---- - -# Input - -```js -{ - using f, f = foo(); -} -{ - using g = foo(); - using g = foo(); -} - -``` - - -# Prettier differences - -```diff ---- Prettier -+++ Rome -@@ -1,8 +1,10 @@ - { -- using f, -- f = foo(); -+ using; -+ f, (f = foo()); - } - { -- using g = foo(); -- using g = foo(); -+ using; -+ g = foo(); -+ using; -+ g = foo(); - } -``` - -# Output - -```js -{ - using; - f, (f = foo()); -} -{ - using; - g = foo(); - using; - g = foo(); -} -``` - -# Errors -``` -invalid-duplicate-using-bindings.js:2:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a semicolon or an implicit semicolon after a statement, but found none - - 1 │ { - > 2 │ using f, f = foo(); - │ ^ - 3 │ } - 4 │ { - - i An explicit or implicit semicolon is expected here... - - 1 │ { - > 2 │ using f, f = foo(); - │ ^ - 3 │ } - 4 │ { - - i ...Which is required to end this statement - - 1 │ { - > 2 │ using f, f = foo(); - │ ^^^^^^^ - 3 │ } - 4 │ { - -invalid-duplicate-using-bindings.js:5:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a semicolon or an implicit semicolon after a statement, but found none - - 3 │ } - 4 │ { - > 5 │ using g = foo(); - │ ^ - 6 │ using g = foo(); - 7 │ } - - i An explicit or implicit semicolon is expected here... - - 3 │ } - 4 │ { - > 5 │ using g = foo(); - │ ^ - 6 │ using g = foo(); - 7 │ } - - i ...Which is required to end this statement - - 3 │ } - 4 │ { - > 5 │ using g = foo(); - │ ^^^^^^^ - 6 │ using g = foo(); - 7 │ } - -invalid-duplicate-using-bindings.js:6:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a semicolon or an implicit semicolon after a statement, but found none - - 4 │ { - 5 │ using g = foo(); - > 6 │ using g = foo(); - │ ^ - 7 │ } - 8 │ - - i An explicit or implicit semicolon is expected here... - - 4 │ { - 5 │ using g = foo(); - > 6 │ using g = foo(); - │ ^ - 7 │ } - 8 │ - - i ...Which is required to end this statement - - 4 │ { - 5 │ using g = foo(); - > 6 │ using g = foo(); - │ ^^^^^^^ - 7 │ } - 8 │ - - -``` - - diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/explicit-resource-management/invalid-script-top-level-using-binding.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/explicit-resource-management/invalid-script-top-level-using-binding.js.snap deleted file mode 100644 index 96005128f56..00000000000 --- a/crates/rome_js_formatter/tests/specs/prettier/js/explicit-resource-management/invalid-script-top-level-using-binding.js.snap +++ /dev/null @@ -1,57 +0,0 @@ ---- -source: crates/rome_formatter_test/src/snapshot_builder.rs -info: js/explicit-resource-management/invalid-script-top-level-using-binding.js ---- - -# Input - -```js -using x = bar(); - -``` - - -# Prettier differences - -```diff ---- Prettier -+++ Rome -@@ -1 +1,2 @@ --using x = bar(); -+using; -+x = bar(); -``` - -# Output - -```js -using; -x = bar(); -``` - -# Errors -``` -invalid-script-top-level-using-binding.js:1:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a semicolon or an implicit semicolon after a statement, but found none - - > 1 │ using x = bar(); - │ ^ - 2 │ - - i An explicit or implicit semicolon is expected here... - - > 1 │ using x = bar(); - │ ^ - 2 │ - - i ...Which is required to end this statement - - > 1 │ using x = bar(); - │ ^^^^^^^ - 2 │ - - -``` - - diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/explicit-resource-management/using-declarations.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/explicit-resource-management/using-declarations.js.snap deleted file mode 100644 index 81b290fa376..00000000000 --- a/crates/rome_js_formatter/tests/specs/prettier/js/explicit-resource-management/using-declarations.js.snap +++ /dev/null @@ -1,203 +0,0 @@ ---- -source: crates/rome_formatter_test/src/snapshot_builder.rs -info: js/explicit-resource-management/using-declarations.js ---- - -# Input - -```js -{ - using /* 1 */ a = foo(), /* 2 */ b = foo() -} - -for(using /* 1 */ a = foo(), /* 2 */ b = foo();;); - -for(using /* 1 */ foo of bar()); - -``` - - -# Prettier differences - -```diff ---- Prettier -+++ Rome -@@ -1,8 +1,10 @@ - { -- using /* 1 */ a = foo(), -- /* 2 */ b = foo(); -+ using; /* 1 */ -+ (a = foo()), /* 2 */ (b = foo()); - } - --for (using /* 1 */ a = foo(), /* 2 */ b = foo(); ; ); -+for(using /* 1 */ a = foo(), /* 2 */ b = foo();; -+) - --for (using /* 1 */ foo of bar()); -+for(using /* 1 */ foo of bar() -+) -``` - -# Output - -```js -{ - using; /* 1 */ - (a = foo()), /* 2 */ (b = foo()); -} - -for(using /* 1 */ a = foo(), /* 2 */ b = foo();; -) - -for(using /* 1 */ foo of bar() -) -``` - -# Errors -``` -using-declarations.js:2:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a semicolon or an implicit semicolon after a statement, but found none - - 1 │ { - > 2 │ using /* 1 */ a = foo(), /* 2 */ b = foo() - │ ^ - 3 │ } - 4 │ - - i An explicit or implicit semicolon is expected here... - - 1 │ { - > 2 │ using /* 1 */ a = foo(), /* 2 */ b = foo() - │ ^ - 3 │ } - 4 │ - - i ...Which is required to end this statement - - 1 │ { - > 2 │ using /* 1 */ a = foo(), /* 2 */ b = foo() - │ ^^^^^^^^^^^^^^^ - 3 │ } - 4 │ - -using-declarations.js:5:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `;` but instead found `a` - - 3 │ } - 4 │ - > 5 │ for(using /* 1 */ a = foo(), /* 2 */ b = foo();;); - │ ^ - 6 │ - 7 │ for(using /* 1 */ foo of bar()); - - i Remove a - -using-declarations.js:5:48 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected an expression but instead found ';' - - 3 │ } - 4 │ - > 5 │ for(using /* 1 */ a = foo(), /* 2 */ b = foo();;); - │ ^ - 6 │ - 7 │ for(using /* 1 */ foo of bar()); - - i Expected an expression here - - 3 │ } - 4 │ - > 5 │ for(using /* 1 */ a = foo(), /* 2 */ b = foo();;); - │ ^ - 6 │ - 7 │ for(using /* 1 */ foo of bar()); - -using-declarations.js:5:49 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected a statement but instead found ')' - - 3 │ } - 4 │ - > 5 │ for(using /* 1 */ a = foo(), /* 2 */ b = foo();;); - │ ^ - 6 │ - 7 │ for(using /* 1 */ foo of bar()); - - i Expected a statement here - - 3 │ } - 4 │ - > 5 │ for(using /* 1 */ a = foo(), /* 2 */ b = foo();;); - │ ^ - 6 │ - 7 │ for(using /* 1 */ foo of bar()); - -using-declarations.js:7:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `;` but instead found `foo` - - 5 │ for(using /* 1 */ a = foo(), /* 2 */ b = foo();;); - 6 │ - > 7 │ for(using /* 1 */ foo of bar()); - │ ^^^ - 8 │ - - i Remove foo - -using-declarations.js:7:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `;` but instead found `of` - - 5 │ for(using /* 1 */ a = foo(), /* 2 */ b = foo();;); - 6 │ - > 7 │ for(using /* 1 */ foo of bar()); - │ ^^ - 8 │ - - i Remove of - -using-declarations.js:7:26 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `)` but instead found `bar` - - 5 │ for(using /* 1 */ a = foo(), /* 2 */ b = foo();;); - 6 │ - > 7 │ for(using /* 1 */ foo of bar()); - │ ^^^ - 8 │ - - i Remove bar - -using-declarations.js:7:31 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a semicolon or an implicit semicolon after a statement, but found none - - 5 │ for(using /* 1 */ a = foo(), /* 2 */ b = foo();;); - 6 │ - > 7 │ for(using /* 1 */ foo of bar()); - │ ^ - 8 │ - - i An explicit or implicit semicolon is expected here... - - 5 │ for(using /* 1 */ a = foo(), /* 2 */ b = foo();;); - 6 │ - > 7 │ for(using /* 1 */ foo of bar()); - │ ^ - 8 │ - - i ...Which is required to end this statement - - 5 │ for(using /* 1 */ a = foo(), /* 2 */ b = foo();;); - 6 │ - > 7 │ for(using /* 1 */ foo of bar()); - │ ^^^^^^ - 8 │ - - -``` - - diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/explicit-resource-management/valid-await-using-binding-basic.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/explicit-resource-management/valid-await-using-binding-basic.js.snap deleted file mode 100644 index 7caaf4d7beb..00000000000 --- a/crates/rome_js_formatter/tests/specs/prettier/js/explicit-resource-management/valid-await-using-binding-basic.js.snap +++ /dev/null @@ -1,69 +0,0 @@ ---- -source: crates/rome_formatter_test/src/snapshot_builder.rs -info: js/explicit-resource-management/valid-await-using-binding-basic.js ---- - -# Input - -```js -async function f() { - await using basic = getReader(); -} - -``` - - -# Prettier differences - -```diff ---- Prettier -+++ Rome -@@ -1,3 +1,4 @@ - async function f() { -- await using basic = getReader(); -+ await using; -+ basic = getReader(); - } -``` - -# Output - -```js -async function f() { - await using; - basic = getReader(); -} -``` - -# Errors -``` -valid-await-using-binding-basic.js:2:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a semicolon or an implicit semicolon after a statement, but found none - - 1 │ async function f() { - > 2 │ await using basic = getReader(); - │ ^^^^^ - 3 │ } - 4 │ - - i An explicit or implicit semicolon is expected here... - - 1 │ async function f() { - > 2 │ await using basic = getReader(); - │ ^^^^^ - 3 │ } - 4 │ - - i ...Which is required to end this statement - - 1 │ async function f() { - > 2 │ await using basic = getReader(); - │ ^^^^^^^^^^^^^^^^^ - 3 │ } - 4 │ - - -``` - - diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/explicit-resource-management/valid-await-using-binding-escaped.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/explicit-resource-management/valid-await-using-binding-escaped.js.snap index 67d016a39b8..370aa4a59c1 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/explicit-resource-management/valid-await-using-binding-escaped.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/explicit-resource-management/valid-await-using-binding-escaped.js.snap @@ -18,11 +18,10 @@ async function f() { ```diff --- Prettier +++ Rome -@@ -1,3 +1,4 @@ +@@ -1,3 +1,3 @@ async function f() { - await using ab = c; -+ await using; -+ \u0061b = c; ++ await using \u0061b = c; } ``` @@ -30,40 +29,8 @@ async function f() { ```js async function f() { - await using; - \u0061b = c; + await using \u0061b = c; } ``` -# Errors -``` -valid-await-using-binding-escaped.js:2:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a semicolon or an implicit semicolon after a statement, but found none - - 1 │ async function f() { - > 2 │ await using \u0061b = c; - │ ^^^^^^^ - 3 │ } - 4 │ - - i An explicit or implicit semicolon is expected here... - - 1 │ async function f() { - > 2 │ await using \u0061b = c; - │ ^^^^^^^ - 3 │ } - 4 │ - - i ...Which is required to end this statement - - 1 │ async function f() { - > 2 │ await using \u0061b = c; - │ ^^^^^^^^^^^^^^^^^^^ - 3 │ } - 4 │ - - -``` - diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/explicit-resource-management/valid-await-using-binding-non-bmp.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/explicit-resource-management/valid-await-using-binding-non-bmp.js.snap deleted file mode 100644 index 7b3be0333ea..00000000000 --- a/crates/rome_js_formatter/tests/specs/prettier/js/explicit-resource-management/valid-await-using-binding-non-bmp.js.snap +++ /dev/null @@ -1,69 +0,0 @@ ---- -source: crates/rome_formatter_test/src/snapshot_builder.rs -info: js/explicit-resource-management/valid-await-using-binding-non-bmp.js ---- - -# Input - -```js -async function f() { - await using 𠮷 = foo(); -} - -``` - - -# Prettier differences - -```diff ---- Prettier -+++ Rome -@@ -1,3 +1,4 @@ - async function f() { -- await using 𠮷 = foo(); -+ await using; -+ 𠮷 = foo(); - } -``` - -# Output - -```js -async function f() { - await using; - 𠮷 = foo(); -} -``` - -# Errors -``` -valid-await-using-binding-non-bmp.js:2:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a semicolon or an implicit semicolon after a statement, but found none - - 1 │ async function f() { - > 2 │ await using 𠮷 = foo(); - │ ^^ - 3 │ } - 4 │ - - i An explicit or implicit semicolon is expected here... - - 1 │ async function f() { - > 2 │ await using 𠮷 = foo(); - │ ^^ - 3 │ } - 4 │ - - i ...Which is required to end this statement - - 1 │ async function f() { - > 2 │ await using 𠮷 = foo(); - │ ^^^^^^^^^^^^^^ - 3 │ } - 4 │ - - -``` - - diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/explicit-resource-management/valid-await-using-binding-using.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/explicit-resource-management/valid-await-using-binding-using.js.snap deleted file mode 100644 index effec5fc5b1..00000000000 --- a/crates/rome_js_formatter/tests/specs/prettier/js/explicit-resource-management/valid-await-using-binding-using.js.snap +++ /dev/null @@ -1,143 +0,0 @@ ---- -source: crates/rome_formatter_test/src/snapshot_builder.rs -info: js/explicit-resource-management/valid-await-using-binding-using.js ---- - -# Input - -```js -async function f() { - await using using = of; - for (await using using of of); -} - -``` - - -# Prettier differences - -```diff ---- Prettier -+++ Rome -@@ -1,4 +1,6 @@ - async function f() { -- await using using = of; -- for (await using using of of); -+ await using; -+ using = of; -+ for (await using using of of -+ ) - } -``` - -# Output - -```js -async function f() { - await using; - using = of; - for (await using using of of - ) -} -``` - -# Errors -``` -valid-await-using-binding-using.js:2:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a semicolon or an implicit semicolon after a statement, but found none - - 1 │ async function f() { - > 2 │ await using using = of; - │ ^^^^^ - 3 │ for (await using using of of); - 4 │ } - - i An explicit or implicit semicolon is expected here... - - 1 │ async function f() { - > 2 │ await using using = of; - │ ^^^^^ - 3 │ for (await using using of of); - 4 │ } - - i ...Which is required to end this statement - - 1 │ async function f() { - > 2 │ await using using = of; - │ ^^^^^^^^^^^^^^^^^ - 3 │ for (await using using of of); - 4 │ } - -valid-await-using-binding-using.js:3:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `;` but instead found `using` - - 1 │ async function f() { - 2 │ await using using = of; - > 3 │ for (await using using of of); - │ ^^^^^ - 4 │ } - 5 │ - - i Remove using - -valid-await-using-binding-using.js:3:26 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `;` but instead found `of` - - 1 │ async function f() { - 2 │ await using using = of; - > 3 │ for (await using using of of); - │ ^^ - 4 │ } - 5 │ - - i Remove of - -valid-await-using-binding-using.js:3:29 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `)` but instead found `of` - - 1 │ async function f() { - 2 │ await using using = of; - > 3 │ for (await using using of of); - │ ^^ - 4 │ } - 5 │ - - i Remove of - -valid-await-using-binding-using.js:3:31 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a semicolon or an implicit semicolon after a statement, but found none - - 1 │ async function f() { - 2 │ await using using = of; - > 3 │ for (await using using of of); - │ ^ - 4 │ } - 5 │ - - i An explicit or implicit semicolon is expected here... - - 1 │ async function f() { - 2 │ await using using = of; - > 3 │ for (await using using of of); - │ ^ - 4 │ } - 5 │ - - i ...Which is required to end this statement - - 1 │ async function f() { - 2 │ await using using = of; - > 3 │ for (await using using of of); - │ ^^^ - 4 │ } - 5 │ - - -``` - - diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/explicit-resource-management/valid-await-using-comments.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/explicit-resource-management/valid-await-using-comments.js.snap index 361e5f66c1a..8846593ec88 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/explicit-resource-management/valid-await-using-comments.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/explicit-resource-management/valid-await-using-comments.js.snap @@ -29,34 +29,21 @@ async function f() { ```diff --- Prettier +++ Rome -@@ -1,19 +1,18 @@ +@@ -1,13 +1,12 @@ async function f() { { - /*0*/ await using /*1*/ /*2*/ b /*3*/ = /*4*/ f(); /*5*/ -+ /*0*/ await /*1*/ using; /*2*/ -+ b /*3*/ = /*4*/ f() /*5*/; ++ /*0*/ await using /*1*/ /*2*/ b /*3*/ = /*4*/ f() /*5*/; } { -- /*0*/ for ( -- /*1*/ /*2*/ await using /*3*/ /*4*/ b /*5*/ = -- /*6*/ x /*7*/ /*8*/ /*9*/ /*10*/; -- ; + /*0*/ for ( + /*1*/ /*2*/ await using /*3*/ /*4*/ b /*5*/ = + /*6*/ x /*7*/ /*8*/ /*9*/ /*10*/; + ; - -- ); -+ /*0*/ for/*1*/(/*2*/await/*3*/using/*4*/b/*5*/=/*6*/x/*7*/;/*8*/; /*9*/ -+ ) /*10*/ + ); } { -- /*0*/ for (/*1*/ /*2*/ await using /*3*/ /*4*/ b /*5*/ of /*6*/ x /*7*/ /*8*/); -+ /*0*/ for/*1*/(/*2*/await/*3*/using/*4*/b/*5*/of/*6*/x /*7*/ -+ ) /*8*/ - } - { -- /*0*/ for await (/*1*/ /*2*/ /*3*/ await using /*4*/ /*5*/ b /*6*/ of /*7*/ x /*8*/ /*9*/); -+ /*0*/ for/*1*/await/*2*/(/*3*/await/*4*/using/*5*/b/*6*/of/*7*/x /*8*/ -+ ) /*9*/ - } - } ``` # Output @@ -64,294 +51,28 @@ async function f() { ```js async function f() { { - /*0*/ await /*1*/ using; /*2*/ - b /*3*/ = /*4*/ f() /*5*/; + /*0*/ await using /*1*/ /*2*/ b /*3*/ = /*4*/ f() /*5*/; } { - /*0*/ for/*1*/(/*2*/await/*3*/using/*4*/b/*5*/=/*6*/x/*7*/;/*8*/; /*9*/ - ) /*10*/ + /*0*/ for ( + /*1*/ /*2*/ await using /*3*/ /*4*/ b /*5*/ = + /*6*/ x /*7*/ /*8*/ /*9*/ /*10*/; + ; + ); } { - /*0*/ for/*1*/(/*2*/await/*3*/using/*4*/b/*5*/of/*6*/x /*7*/ - ) /*8*/ + /*0*/ for (/*1*/ /*2*/ await using /*3*/ /*4*/ b /*5*/ of /*6*/ x /*7*/ /*8*/); } { - /*0*/ for/*1*/await/*2*/(/*3*/await/*4*/using/*5*/b/*6*/of/*7*/x /*8*/ - ) /*9*/ + /*0*/ for await (/*1*/ /*2*/ /*3*/ await using /*4*/ /*5*/ b /*6*/ of /*7*/ x /*8*/ /*9*/); } } ``` -# Errors +# Lines exceeding max width of 80 characters ``` -valid-await-using-comments.js:3:28 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a semicolon or an implicit semicolon after a statement, but found none - - 1 │ async function f() { - 2 │ { - > 3 │ /*0*/await/*1*/using/*2*/b/*3*/=/*4*/f()/*5*/; - │ ^ - 4 │ } - 5 │ { - - i An explicit or implicit semicolon is expected here... - - 1 │ async function f() { - 2 │ { - > 3 │ /*0*/await/*1*/using/*2*/b/*3*/=/*4*/f()/*5*/; - │ ^ - 4 │ } - 5 │ { - - i ...Which is required to end this statement - - 1 │ async function f() { - 2 │ { - > 3 │ /*0*/await/*1*/using/*2*/b/*3*/=/*4*/f()/*5*/; - │ ^^^^^^^^^^^^^^^^^^^^^ - 4 │ } - 5 │ { - -valid-await-using-comments.js:6:42 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `;` but instead found `b` - - 4 │ } - 5 │ { - > 6 │ /*0*/for/*1*/(/*2*/await/*3*/using/*4*/b/*5*/=/*6*/x/*7*/;/*8*/;/*9*/)/*10*/; - │ ^ - 7 │ } - 8 │ { - - i Remove b - -valid-await-using-comments.js:6:66 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected an expression but instead found ';' - - 4 │ } - 5 │ { - > 6 │ /*0*/for/*1*/(/*2*/await/*3*/using/*4*/b/*5*/=/*6*/x/*7*/;/*8*/;/*9*/)/*10*/; - │ ^ - 7 │ } - 8 │ { - - i Expected an expression here - - 4 │ } - 5 │ { - > 6 │ /*0*/for/*1*/(/*2*/await/*3*/using/*4*/b/*5*/=/*6*/x/*7*/;/*8*/;/*9*/)/*10*/; - │ ^ - 7 │ } - 8 │ { - -valid-await-using-comments.js:6:72 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected a statement but instead found ')' - - 4 │ } - 5 │ { - > 6 │ /*0*/for/*1*/(/*2*/await/*3*/using/*4*/b/*5*/=/*6*/x/*7*/;/*8*/;/*9*/)/*10*/; - │ ^ - 7 │ } - 8 │ { - - i Expected a statement here - - 4 │ } - 5 │ { - > 6 │ /*0*/for/*1*/(/*2*/await/*3*/using/*4*/b/*5*/=/*6*/x/*7*/;/*8*/;/*9*/)/*10*/; - │ ^ - 7 │ } - 8 │ { - -valid-await-using-comments.js:9:42 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `;` but instead found `b` - - 7 │ } - 8 │ { - > 9 │ /*0*/for/*1*/(/*2*/await/*3*/using/*4*/b/*5*/of/*6*/x/*7*/)/*8*/; - │ ^ - 10 │ } - 11 │ { - - i Remove b - -valid-await-using-comments.js:9:48 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `;` but instead found `of` - - 7 │ } - 8 │ { - > 9 │ /*0*/for/*1*/(/*2*/await/*3*/using/*4*/b/*5*/of/*6*/x/*7*/)/*8*/; - │ ^^ - 10 │ } - 11 │ { - - i Remove of - -valid-await-using-comments.js:9:55 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `)` but instead found `x` - - 7 │ } - 8 │ { - > 9 │ /*0*/for/*1*/(/*2*/await/*3*/using/*4*/b/*5*/of/*6*/x/*7*/)/*8*/; - │ ^ - 10 │ } - 11 │ { - - i Remove x - -valid-await-using-comments.js:9:61 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a semicolon or an implicit semicolon after a statement, but found none - - 7 │ } - 8 │ { - > 9 │ /*0*/for/*1*/(/*2*/await/*3*/using/*4*/b/*5*/of/*6*/x/*7*/)/*8*/; - │ ^ - 10 │ } - 11 │ { - - i An explicit or implicit semicolon is expected here... - - 7 │ } - 8 │ { - > 9 │ /*0*/for/*1*/(/*2*/await/*3*/using/*4*/b/*5*/of/*6*/x/*7*/)/*8*/; - │ ^ - 10 │ } - 11 │ { - - i ...Which is required to end this statement - - 7 │ } - 8 │ { - > 9 │ /*0*/for/*1*/(/*2*/await/*3*/using/*4*/b/*5*/of/*6*/x/*7*/)/*8*/; - │ ^^^^^^^ - 10 │ } - 11 │ { - -valid-await-using-comments.js:12:52 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `;` but instead found `b` - - 10 │ } - 11 │ { - > 12 │ /*0*/for/*1*/await/*2*/(/*3*/await/*4*/using/*5*/b/*6*/of/*7*/x/*8*/)/*9*/; - │ ^ - 13 │ } - 14 │ } - - i Remove b - -valid-await-using-comments.js:12:58 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `;` but instead found `of` - - 10 │ } - 11 │ { - > 12 │ /*0*/for/*1*/await/*2*/(/*3*/await/*4*/using/*5*/b/*6*/of/*7*/x/*8*/)/*9*/; - │ ^^ - 13 │ } - 14 │ } - - i Remove of - -valid-await-using-comments.js:12:65 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `)` but instead found `x` - - 10 │ } - 11 │ { - > 12 │ /*0*/for/*1*/await/*2*/(/*3*/await/*4*/using/*5*/b/*6*/of/*7*/x/*8*/)/*9*/; - │ ^ - 13 │ } - 14 │ } - - i Remove x - -valid-await-using-comments.js:12:71 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a semicolon or an implicit semicolon after a statement, but found none - - 10 │ } - 11 │ { - > 12 │ /*0*/for/*1*/await/*2*/(/*3*/await/*4*/using/*5*/b/*6*/of/*7*/x/*8*/)/*9*/; - │ ^ - 13 │ } - 14 │ } - - i An explicit or implicit semicolon is expected here... - - 10 │ } - 11 │ { - > 12 │ /*0*/for/*1*/await/*2*/(/*3*/await/*4*/using/*5*/b/*6*/of/*7*/x/*8*/)/*9*/; - │ ^ - 13 │ } - 14 │ } - - i ...Which is required to end this statement - - 10 │ } - 11 │ { - > 12 │ /*0*/for/*1*/await/*2*/(/*3*/await/*4*/using/*5*/b/*6*/of/*7*/x/*8*/)/*9*/; - │ ^^^^^^^ - 13 │ } - 14 │ } - -valid-await-using-comments.js:12:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × await can only be used in conjunction with `for...of` statements - - 10 │ } - 11 │ { - > 12 │ /*0*/for/*1*/await/*2*/(/*3*/await/*4*/using/*5*/b/*6*/of/*7*/x/*8*/)/*9*/; - │ ^^^^^ - 13 │ } - 14 │ } - - i Remove the await here - - 10 │ } - 11 │ { - > 12 │ /*0*/for/*1*/await/*2*/(/*3*/await/*4*/using/*5*/b/*6*/of/*7*/x/*8*/)/*9*/; - │ ^^^^^ - 13 │ } - 14 │ } - - i or convert this to a `for...of` statement - - 10 │ } - 11 │ { - > 12 │ /*0*/for/*1*/await/*2*/(/*3*/await/*4*/using/*5*/b/*6*/of/*7*/x/*8*/)/*9*/; - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - 13 │ } - 14 │ } - -valid-await-using-comments.js:12:71 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected a statement but instead found ')' - - 10 │ } - 11 │ { - > 12 │ /*0*/for/*1*/await/*2*/(/*3*/await/*4*/using/*5*/b/*6*/of/*7*/x/*8*/)/*9*/; - │ ^ - 13 │ } - 14 │ } - - i Expected a statement here - - 10 │ } - 11 │ { - > 12 │ /*0*/for/*1*/await/*2*/(/*3*/await/*4*/using/*5*/b/*6*/of/*7*/x/*8*/)/*9*/; - │ ^ - 13 │ } - 14 │ } - - + 13: /*0*/ for (/*1*/ /*2*/ await using /*3*/ /*4*/ b /*5*/ of /*6*/ x /*7*/ /*8*/); + 16: /*0*/ for await (/*1*/ /*2*/ /*3*/ await using /*4*/ /*5*/ b /*6*/ of /*7*/ x /*8*/ /*9*/); ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/explicit-resource-management/valid-for-using-binding-of-of.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/explicit-resource-management/valid-for-using-binding-of-of.js.snap deleted file mode 100644 index 7485692e758..00000000000 --- a/crates/rome_js_formatter/tests/specs/prettier/js/explicit-resource-management/valid-for-using-binding-of-of.js.snap +++ /dev/null @@ -1,154 +0,0 @@ ---- -source: crates/rome_formatter_test/src/snapshot_builder.rs -info: js/explicit-resource-management/valid-for-using-binding-of-of.js ---- - -# Input - -```js -async function f() { - for (await using of of of); - for await (await using of of of); -} - -``` - - -# Prettier differences - -```diff ---- Prettier -+++ Rome -@@ -1,4 +1,6 @@ - async function f() { -- for (await using of of of); -- for await (await using of of of); -+ for (await using of of of -+ ) -+ for await (await using of of of -+ ) - } -``` - -# Output - -```js -async function f() { - for (await using of of of - ) - for await (await using of of of - ) -} -``` - -# Errors -``` -valid-for-using-binding-of-of.js:2:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Invalid assignment to `await using` - - 1 │ async function f() { - > 2 │ for (await using of of of); - │ ^^^^^^^^^^^ - 3 │ for await (await using of of of); - 4 │ } - - i This expression cannot be assigned to - -valid-for-using-binding-of-of.js:2:26 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `)` but instead found `of` - - 1 │ async function f() { - > 2 │ for (await using of of of); - │ ^^ - 3 │ for await (await using of of of); - 4 │ } - - i Remove of - -valid-for-using-binding-of-of.js:2:28 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a semicolon or an implicit semicolon after a statement, but found none - - 1 │ async function f() { - > 2 │ for (await using of of of); - │ ^ - 3 │ for await (await using of of of); - 4 │ } - - i An explicit or implicit semicolon is expected here... - - 1 │ async function f() { - > 2 │ for (await using of of of); - │ ^ - 3 │ for await (await using of of of); - 4 │ } - - i ...Which is required to end this statement - - 1 │ async function f() { - > 2 │ for (await using of of of); - │ ^^^ - 3 │ for await (await using of of of); - 4 │ } - -valid-for-using-binding-of-of.js:3:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Invalid assignment to `await using` - - 1 │ async function f() { - 2 │ for (await using of of of); - > 3 │ for await (await using of of of); - │ ^^^^^^^^^^^ - 4 │ } - 5 │ - - i This expression cannot be assigned to - -valid-for-using-binding-of-of.js:3:32 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `)` but instead found `of` - - 1 │ async function f() { - 2 │ for (await using of of of); - > 3 │ for await (await using of of of); - │ ^^ - 4 │ } - 5 │ - - i Remove of - -valid-for-using-binding-of-of.js:3:34 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a semicolon or an implicit semicolon after a statement, but found none - - 1 │ async function f() { - 2 │ for (await using of of of); - > 3 │ for await (await using of of of); - │ ^ - 4 │ } - 5 │ - - i An explicit or implicit semicolon is expected here... - - 1 │ async function f() { - 2 │ for (await using of of of); - > 3 │ for await (await using of of of); - │ ^ - 4 │ } - 5 │ - - i ...Which is required to end this statement - - 1 │ async function f() { - 2 │ for (await using of of of); - > 3 │ for await (await using of of of); - │ ^^^ - 4 │ } - 5 │ - - -``` - - diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/explicit-resource-management/valid-for-using-declaration.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/explicit-resource-management/valid-for-using-declaration.js.snap deleted file mode 100644 index c6177852b57..00000000000 --- a/crates/rome_js_formatter/tests/specs/prettier/js/explicit-resource-management/valid-for-using-declaration.js.snap +++ /dev/null @@ -1,91 +0,0 @@ ---- -source: crates/rome_formatter_test/src/snapshot_builder.rs -info: js/explicit-resource-management/valid-for-using-declaration.js ---- - -# Input - -```js -async function f() { - for (await using basic = reader();;); -} - -``` - - -# Prettier differences - -```diff ---- Prettier -+++ Rome -@@ -1,3 +1,4 @@ - async function f() { -- for (await using basic = reader(); ; ); -+ for (await using basic = reader();; -+ ) - } -``` - -# Output - -```js -async function f() { - for (await using basic = reader();; - ) -} -``` - -# Errors -``` -valid-for-using-declaration.js:2:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `;` but instead found `basic` - - 1 │ async function f() { - > 2 │ for (await using basic = reader();;); - │ ^^^^^ - 3 │ } - 4 │ - - i Remove basic - -valid-for-using-declaration.js:2:37 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected an expression but instead found ';' - - 1 │ async function f() { - > 2 │ for (await using basic = reader();;); - │ ^ - 3 │ } - 4 │ - - i Expected an expression here - - 1 │ async function f() { - > 2 │ for (await using basic = reader();;); - │ ^ - 3 │ } - 4 │ - -valid-for-using-declaration.js:2:38 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected a statement but instead found ')' - - 1 │ async function f() { - > 2 │ for (await using basic = reader();;); - │ ^ - 3 │ } - 4 │ - - i Expected a statement here - - 1 │ async function f() { - > 2 │ for (await using basic = reader();;); - │ ^ - 3 │ } - 4 │ - - -``` - - diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/explicit-resource-management/valid-module-block-top-level-await-using-binding.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/explicit-resource-management/valid-module-block-top-level-await-using-binding.js.snap index 08f41b3f365..499f0a87ffd 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/explicit-resource-management/valid-module-block-top-level-await-using-binding.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/explicit-resource-management/valid-module-block-top-level-await-using-binding.js.snap @@ -18,14 +18,12 @@ const m = module { ```diff --- Prettier +++ Rome -@@ -1,3 +1,5 @@ +@@ -1,3 +1,4 @@ -const m = module { -- await using foo = bar(); --}; +const m = module; +{ -+ await using; -+ foo = bar(); + await using foo = bar(); +-}; +} ``` @@ -34,8 +32,7 @@ const m = module { ```js const m = module; { - await using; - foo = bar(); + await using foo = bar(); } ``` @@ -64,32 +61,6 @@ valid-module-block-top-level-await-using-binding.js:1:18 parse ━━━━━ 2 │ await using foo = bar(); 3 │ } -valid-module-block-top-level-await-using-binding.js:2:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a semicolon or an implicit semicolon after a statement, but found none - - 1 │ const m = module { - > 2 │ await using foo = bar(); - │ ^^^ - 3 │ } - 4 │ - - i An explicit or implicit semicolon is expected here... - - 1 │ const m = module { - > 2 │ await using foo = bar(); - │ ^^^ - 3 │ } - 4 │ - - i ...Which is required to end this statement - - 1 │ const m = module { - > 2 │ await using foo = bar(); - │ ^^^^^^^^^^^^^^^ - 3 │ } - 4 │ - ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/explicit-resource-management/valid-module-block-top-level-using-binding.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/explicit-resource-management/valid-module-block-top-level-using-binding.js.snap index 6e7b6961e08..d177846d156 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/explicit-resource-management/valid-module-block-top-level-using-binding.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/explicit-resource-management/valid-module-block-top-level-using-binding.js.snap @@ -18,14 +18,12 @@ module { ```diff --- Prettier +++ Rome -@@ -1,3 +1,5 @@ +@@ -1,3 +1,4 @@ -module { -- using foo = bar(); --}; +module; +{ -+ using; -+ foo = bar(); + using foo = bar(); +-}; +} ``` @@ -34,8 +32,7 @@ module { ```js module; { - using; - foo = bar(); + using foo = bar(); } ``` @@ -64,32 +61,6 @@ valid-module-block-top-level-using-binding.js:1:8 parse ━━━━━━━━ 2 │ using foo = bar(); 3 │ } -valid-module-block-top-level-using-binding.js:2:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a semicolon or an implicit semicolon after a statement, but found none - - 1 │ module { - > 2 │ using foo = bar(); - │ ^^^ - 3 │ } - 4 │ - - i An explicit or implicit semicolon is expected here... - - 1 │ module { - > 2 │ using foo = bar(); - │ ^^^ - 3 │ } - 4 │ - - i ...Which is required to end this statement - - 1 │ module { - > 2 │ using foo = bar(); - │ ^^^^^^^^^ - 3 │ } - 4 │ - ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/explicit-resource-management/valid-using-binding-basic.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/explicit-resource-management/valid-using-binding-basic.js.snap deleted file mode 100644 index f93846ae677..00000000000 --- a/crates/rome_js_formatter/tests/specs/prettier/js/explicit-resource-management/valid-using-binding-basic.js.snap +++ /dev/null @@ -1,69 +0,0 @@ ---- -source: crates/rome_formatter_test/src/snapshot_builder.rs -info: js/explicit-resource-management/valid-using-binding-basic.js ---- - -# Input - -```js -{ - using basic = getReader(); -} - -``` - - -# Prettier differences - -```diff ---- Prettier -+++ Rome -@@ -1,3 +1,4 @@ - { -- using basic = getReader(); -+ using; -+ basic = getReader(); - } -``` - -# Output - -```js -{ - using; - basic = getReader(); -} -``` - -# Errors -``` -valid-using-binding-basic.js:2:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a semicolon or an implicit semicolon after a statement, but found none - - 1 │ { - > 2 │ using basic = getReader(); - │ ^^^^^ - 3 │ } - 4 │ - - i An explicit or implicit semicolon is expected here... - - 1 │ { - > 2 │ using basic = getReader(); - │ ^^^^^ - 3 │ } - 4 │ - - i ...Which is required to end this statement - - 1 │ { - > 2 │ using basic = getReader(); - │ ^^^^^^^^^^^ - 3 │ } - 4 │ - - -``` - - diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/explicit-resource-management/valid-using-binding-escaped.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/explicit-resource-management/valid-using-binding-escaped.js.snap index e4a6c104b3d..74323ed07ee 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/explicit-resource-management/valid-using-binding-escaped.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/explicit-resource-management/valid-using-binding-escaped.js.snap @@ -16,11 +16,10 @@ info: js/explicit-resource-management/valid-using-binding-escaped.js ```diff --- Prettier +++ Rome -@@ -1,3 +1,4 @@ +@@ -1,3 +1,3 @@ { - using ab = c; -+ using; -+ \u0061b = c; ++ using \u0061b = c; } ``` @@ -28,34 +27,8 @@ info: js/explicit-resource-management/valid-using-binding-escaped.js ```js { - using; - \u0061b = c; + using \u0061b = c; } ``` -# Errors -``` -valid-using-binding-escaped.js:1:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a semicolon or an implicit semicolon after a statement, but found none - - > 1 │ { using \u0061b = c; } - │ ^^^^^^^ - 2 │ - - i An explicit or implicit semicolon is expected here... - - > 1 │ { using \u0061b = c; } - │ ^^^^^^^ - 2 │ - - i ...Which is required to end this statement - - > 1 │ { using \u0061b = c; } - │ ^^^^^^^^^^^^^ - 2 │ - - -``` - diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/explicit-resource-management/valid-using-binding-non-bmp.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/explicit-resource-management/valid-using-binding-non-bmp.js.snap deleted file mode 100644 index c13065af8ce..00000000000 --- a/crates/rome_js_formatter/tests/specs/prettier/js/explicit-resource-management/valid-using-binding-non-bmp.js.snap +++ /dev/null @@ -1,61 +0,0 @@ ---- -source: crates/rome_formatter_test/src/snapshot_builder.rs -info: js/explicit-resource-management/valid-using-binding-non-bmp.js ---- - -# Input - -```js -{ using 𠮷 = foo(); } - -``` - - -# Prettier differences - -```diff ---- Prettier -+++ Rome -@@ -1,3 +1,4 @@ - { -- using 𠮷 = foo(); -+ using; -+ 𠮷 = foo(); - } -``` - -# Output - -```js -{ - using; - 𠮷 = foo(); -} -``` - -# Errors -``` -valid-using-binding-non-bmp.js:1:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a semicolon or an implicit semicolon after a statement, but found none - - > 1 │ { using 𠮷 = foo(); } - │ ^^ - 2 │ - - i An explicit or implicit semicolon is expected here... - - > 1 │ { using 𠮷 = foo(); } - │ ^^ - 2 │ - - i ...Which is required to end this statement - - > 1 │ { using 𠮷 = foo(); } - │ ^^^^^^^^ - 2 │ - - -``` - - diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/explicit-resource-management/valid-using-binding-using.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/explicit-resource-management/valid-using-binding-using.js.snap deleted file mode 100644 index 6e012e92e65..00000000000 --- a/crates/rome_js_formatter/tests/specs/prettier/js/explicit-resource-management/valid-using-binding-using.js.snap +++ /dev/null @@ -1,143 +0,0 @@ ---- -source: crates/rome_formatter_test/src/snapshot_builder.rs -info: js/explicit-resource-management/valid-using-binding-using.js ---- - -# Input - -```js -{ - using using = of; - for (using using of of); -} - -``` - - -# Prettier differences - -```diff ---- Prettier -+++ Rome -@@ -1,4 +1,6 @@ - { -- using using = of; -- for (using using of of); -+ using; -+ using = of; -+ for (using using of of -+ ) - } -``` - -# Output - -```js -{ - using; - using = of; - for (using using of of - ) -} -``` - -# Errors -``` -valid-using-binding-using.js:2:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a semicolon or an implicit semicolon after a statement, but found none - - 1 │ { - > 2 │ using using = of; - │ ^^^^^ - 3 │ for (using using of of); - 4 │ } - - i An explicit or implicit semicolon is expected here... - - 1 │ { - > 2 │ using using = of; - │ ^^^^^ - 3 │ for (using using of of); - 4 │ } - - i ...Which is required to end this statement - - 1 │ { - > 2 │ using using = of; - │ ^^^^^^^^^^^ - 3 │ for (using using of of); - 4 │ } - -valid-using-binding-using.js:3:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `;` but instead found `using` - - 1 │ { - 2 │ using using = of; - > 3 │ for (using using of of); - │ ^^^^^ - 4 │ } - 5 │ - - i Remove using - -valid-using-binding-using.js:3:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `;` but instead found `of` - - 1 │ { - 2 │ using using = of; - > 3 │ for (using using of of); - │ ^^ - 4 │ } - 5 │ - - i Remove of - -valid-using-binding-using.js:3:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `)` but instead found `of` - - 1 │ { - 2 │ using using = of; - > 3 │ for (using using of of); - │ ^^ - 4 │ } - 5 │ - - i Remove of - -valid-using-binding-using.js:3:25 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a semicolon or an implicit semicolon after a statement, but found none - - 1 │ { - 2 │ using using = of; - > 3 │ for (using using of of); - │ ^ - 4 │ } - 5 │ - - i An explicit or implicit semicolon is expected here... - - 1 │ { - 2 │ using using = of; - > 3 │ for (using using of of); - │ ^ - 4 │ } - 5 │ - - i ...Which is required to end this statement - - 1 │ { - 2 │ using using = of; - > 3 │ for (using using of of); - │ ^^^ - 4 │ } - 5 │ - - -``` - - diff --git a/crates/rome_js_parser/src/lexer/mod.rs b/crates/rome_js_parser/src/lexer/mod.rs index 122fdfdf1ef..043017f4758 100644 --- a/crates/rome_js_parser/src/lexer/mod.rs +++ b/crates/rome_js_parser/src/lexer/mod.rs @@ -1093,6 +1093,7 @@ impl<'src> Lexer<'src> { b"override" => OVERRIDE_KW, b"of" => OF_KW, b"out" => OUT_KW, + b"using" => USING_KW, _ => T![ident], } } diff --git a/crates/rome_js_parser/src/syntax/expr.rs b/crates/rome_js_parser/src/syntax/expr.rs index 016c8c187ef..6c7bbb0551d 100644 --- a/crates/rome_js_parser/src/syntax/expr.rs +++ b/crates/rome_js_parser/src/syntax/expr.rs @@ -1242,7 +1242,6 @@ pub(crate) fn is_nth_at_expression(p: &mut JsParser, n: usize) -> bool { | T![...] | T![this] | T![yield] - | T![await] | T![function] | T![class] | T![import] diff --git a/crates/rome_js_parser/src/syntax/stmt.rs b/crates/rome_js_parser/src/syntax/stmt.rs index cf3201dfd8d..e39620cabea 100644 --- a/crates/rome_js_parser/src/syntax/stmt.rs +++ b/crates/rome_js_parser/src/syntax/stmt.rs @@ -65,6 +65,7 @@ pub const STMT_RECOVERY_SET: TokenSet = token_set![ NAMESPACE_KW, LET_KW, CONST_KW, + USING_KW, MODULE_KW, NAMESPACE_KW, GLOBAL_KW, @@ -206,6 +207,14 @@ pub(crate) fn parse_statement(p: &mut JsParser, context: StatementContext) -> Pa } T![var] => parse_variable_statement(p, context), T![const] => parse_variable_statement(p, context), + T![using] if is_nth_at_using_declaration(p, 0) => parse_variable_statement(p, context), + T![await] => { + if is_nth_at_using_declaration(p, 0) { + parse_variable_statement(p, context) + } else { + parse_expression_statement(p) + } + } T![for] => parse_for_statement(p), T![do] => parse_do_statement(p), T![switch] => parse_switch_statement(p), @@ -1015,11 +1024,25 @@ fn parse_while_statement(p: &mut JsParser) -> ParsedSyntax { pub(crate) fn is_nth_at_variable_declarations(p: &mut JsParser, n: usize) -> bool { match p.nth(n) { T![var] | T![const] => true, + T![await] | T![using] if is_nth_at_using_declaration(p, n) => true, T![let] if is_nth_at_let_variable_statement(p, n) => true, _ => false, } } +pub(crate) fn is_nth_at_using_declaration(p: &mut JsParser, n: usize) -> bool { + let (maybe_using, next_cursor) = match p.nth(n) { + T![using] => (true, n + 1), + T![await] if p.nth_at(n + 1, T![using]) => (true, n + 2), + _ => (false, n + 1), + }; + + maybe_using + && !p.has_nth_preceding_line_break(next_cursor) + && !p.nth_at(next_cursor, T![await]) + && is_nth_at_identifier(p, next_cursor) +} + pub(crate) fn is_nth_at_let_variable_statement(p: &mut JsParser, n: usize) -> bool { if !p.nth_at(n, T![let]) { return false; @@ -1028,7 +1051,7 @@ pub(crate) fn is_nth_at_let_variable_statement(p: &mut JsParser, n: usize) -> bo matches!(p.nth(n + 1), T!['{'] | T!['[']) || is_nth_at_identifier(p, n + 1) } -/// A var, const, or let declaration statement such as `var a = 5, b;` or `let {a, b} = foo;` +/// A var, const, using or let declaration statement such as `var a = 5, b;` or `let {a, b} = foo;` // test js var_decl // var a = 5; // let { foo, bar } = 5; @@ -1038,12 +1061,41 @@ pub(crate) fn is_nth_at_let_variable_statement(p: &mut JsParser, n: usize) -> bo // let foo6 = "lorem", bar7 = "ipsum", third8 = "value", fourth = 6; // var q, w, e, r, t; // +// test js using_declaration_statement +// 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); +// // test_err js variable_declaration_statement_err // let a, { b } = { a: 10 } // const c = 1, { d } = { a: 10 } // const e; // let [f]; // const { g }; +// +// test_err js using_declaration_statement_err +// 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; pub(crate) fn parse_variable_statement( p: &mut JsParser, context: StatementContext, @@ -1053,6 +1105,7 @@ pub(crate) fn parse_variable_statement( // const b = 5 let c = 5; let start = p.cur_range().start(); let is_var = p.at(T![var]); + let is_await_using = p.at(T![await]) && p.nth_at(1, T![using]); parse_variable_declaration(p, VariableDeclarationParent::VariableStatement).map(|declaration| { let m = declaration.precede(p); @@ -1077,6 +1130,23 @@ pub(crate) fn parse_variable_statement( statement.change_to_bogus(p); } + let is_top_level_module_or_async_fn = + p.state().in_async() && (p.state().is_top_level() || p.state().in_function()); + if is_await_using && !is_top_level_module_or_async_fn { + // test_err js await_using_declaration_only_allowed_inside_an_async_function + // function foo() { await using x = y }; + // foo = function() { await using x = y }; + // foo = () => { await using x = y }; + p.error( + p.err_builder( + "`await using` declarations are only allowed at top-level or inside an async function", + statement.range(p), + ) + .hint("Wrap this declaration in an async function"), + ); + statement.change_to_bogus(p); + } + statement }) } @@ -1107,8 +1177,7 @@ pub(super) enum VariableDeclarationParent { Clause, } -/// Parses a variable declaration that consist of a variable kind (`let`, `const` or `var` and a list -/// of variable declarators). +/// Parses and consume variable declarations like `var`/`let`/`const`/`using`/`await using`. /// Returns a tuple where /// * the first element is the marker to the not yet completed list /// * the second element is the range of all variable declarations except the first one. Is [None] if @@ -1124,12 +1193,21 @@ fn eat_variable_declaration( p.bump(T![var]); } T![const] => { - context.is_const = Some(p.cur_range()); p.bump(T![const]); + context.kind_name = Some("const"); } T![let] => { p.bump(T![let]); - context.is_let = true; + context.kind_name = Some("let"); + } + T![using] => { + p.bump(T![using]); + context.kind_name = Some("using"); + } + T![await] if p.nth_at(1, T![using]) => { + p.bump(T![await]); + p.bump(T![using]); + context.kind_name = Some("using"); } _ => { return None; @@ -1214,10 +1292,8 @@ impl ParseSeparatedList for VariableDeclaratorList { } struct VariableDeclaratorContext { - /// The range of the `const` keyword if this is `const` variable declaration. - is_const: Option, - /// `true` if this is a let variable declaration - is_let: bool, + /// What kind of variable declaration is this (`var`, `let`, `const`, 'using') + kind_name: Option<&'static str>, /// Is this the first declaration in the declaration list (a first, b second in `let a, b`) is_first: bool, /// What's the parent of the variable declaration @@ -1228,20 +1304,21 @@ impl VariableDeclaratorContext { fn new(parent: VariableDeclarationParent) -> Self { Self { parent, - is_const: None, - is_let: false, + kind_name: None, is_first: true, } } - fn duplicate_binding_parent_name(&self) -> Option<&'static str> { - if self.is_const.is_some() { - Some("const") - } else if self.is_let { - Some("let") - } else { - None - } + fn is_var(&self) -> bool { + matches!(self.kind_name, None) + } + + fn is_const(&self) -> bool { + matches!(self.kind_name, Some("const")) + } + + fn is_using(&self) -> bool { + matches!(self.kind_name, Some("using")) } } @@ -1252,12 +1329,22 @@ impl VariableDeclaratorContext { // } // }; // +// test js using_declarations_inside_for_statement +// for (using x of y) {}; +// for await (using x of y) {}; +// for (await using x of y) {}; +// for await (await using x of y) {}; +// +// test_err js invalid_using_declarations_inside_for_statement +// for (await using of x) {}; +// for await (await using of x) {}; +// // A single declarator, either `ident` or `ident = assign_expr` fn parse_variable_declarator( p: &mut JsParser, context: &VariableDeclaratorContext, ) -> ParsedSyntax { - p.state_mut().duplicate_binding_parent = context.duplicate_binding_parent_name(); + p.state_mut().duplicate_binding_parent = context.kind_name; let id = parse_binding_pattern(p, ExpressionContext::default()); p.state_mut().duplicate_binding_parent = None; @@ -1323,6 +1410,17 @@ fn parse_variable_declarator( ts_annotation.change_to_bogus(p); } } + + + // test_err js using_declaration_not_allowed_in_for_in_statement + // for (using x in y) {}; + // for (await using x in y) {}; + if context.is_using() && is_in_for_in { + let err = p + .err_builder("The left-hand side of a 'for...in' statement cannot be a 'using' declaration", id_range); + p.error(err); + } + if let Some(initializer) = initializer { // Initializers are disallowed for `for..in` and `for..of`, // except for `for(var ... in ...)` in loose mode @@ -1346,11 +1444,14 @@ fn parse_variable_declarator( // 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) {}; let is_strict = StrictMode.is_supported(p); - let is_var = !context.is_let && context.is_const.is_none(); - if is_strict || !is_in_for_in || !is_var { + if is_strict || !is_in_for_in || !context.is_var() { let err = p .err_builder(if is_in_for_in { "`for..in` statement declarators cannot have an initializer expression" @@ -1375,9 +1476,15 @@ fn parse_variable_declarator( ); p.error(err); - } else if initializer.is_none() && context.is_const.is_some() && !p.state().in_ambient_context() { + } else if initializer.is_none() && context.is_const() && !p.state().in_ambient_context() { + let err = p + .err_builder("Const declarations must have an initialized value", id_range) + .hint( "this variable needs to be initialized"); + + p.error(err); + } else if initializer.is_none() && context.is_using() { let err = p - .err_builder("Const var declarations must have an initialized value", id_range) + .err_builder("Using declarations must have an initialized value", id_range) .hint( "this variable needs to be initialized"); p.error(err); @@ -1477,7 +1584,7 @@ fn parse_for_head(p: &mut JsParser, has_l_paren: bool, is_for_await: bool) -> Js // `for (let...` | `for (const...` | `for (var...` - if p.at(T![const]) || p.at(T![var]) || is_nth_at_let_variable_statement(p, 0) { + if is_nth_at_variable_declarations(p, 0) { let m = p.start(); let (declarations, additional_declarations) = diff --git a/crates/rome_js_parser/test_data/inline/err/array_binding_err.rast b/crates/rome_js_parser/test_data/inline/err/array_binding_err.rast index 1ce3a6334d6..2c991a014f7 100644 --- a/crates/rome_js_parser/test_data/inline/err/array_binding_err.rast +++ b/crates/rome_js_parser/test_data/inline/err/array_binding_err.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@0..4 "let" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -44,6 +45,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@19..24 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -84,6 +86,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@46..51 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -122,6 +125,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@72..77 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -165,8 +169,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..88 0: JS_VARIABLE_STATEMENT@0..19 0: JS_VARIABLE_DECLARATION@0..18 - 0: LET_KW@0..4 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@4..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 "[" [] [] @@ -192,8 +197,9 @@ JsModule { 1: SEMICOLON@18..19 ";" [] [] 1: JS_VARIABLE_STATEMENT@19..46 0: JS_VARIABLE_DECLARATION@19..45 - 0: LET_KW@19..24 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@24..45 + 0: (empty) + 1: LET_KW@19..24 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@24..45 0: JS_VARIABLE_DECLARATOR@24..45 0: JS_ARRAY_BINDING_PATTERN@24..37 0: L_BRACK@24..25 "[" [] [] @@ -219,8 +225,9 @@ JsModule { 1: SEMICOLON@45..46 ";" [] [] 2: JS_VARIABLE_STATEMENT@46..72 0: JS_VARIABLE_DECLARATION@46..71 - 0: LET_KW@46..51 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@51..71 + 0: (empty) + 1: LET_KW@46..51 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@51..71 0: JS_VARIABLE_DECLARATOR@51..71 0: JS_ARRAY_BINDING_PATTERN@51..63 0: L_BRACK@51..52 "[" [] [] @@ -243,8 +250,9 @@ JsModule { 1: SEMICOLON@71..72 ";" [] [] 3: JS_VARIABLE_STATEMENT@72..88 0: JS_VARIABLE_DECLARATION@72..87 - 0: LET_KW@72..77 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@77..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 "[" [] [] diff --git a/crates/rome_js_parser/test_data/inline/err/array_binding_rest_err.rast b/crates/rome_js_parser/test_data/inline/err/array_binding_rest_err.rast index 480ef2bd5a8..7dcf508703a 100644 --- a/crates/rome_js_parser/test_data/inline/err/array_binding_rest_err.rast +++ b/crates/rome_js_parser/test_data/inline/err/array_binding_rest_err.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@0..4 "let" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -135,8 +136,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..85 0: JS_VARIABLE_STATEMENT@0..16 0: JS_VARIABLE_DECLARATION@0..15 - 0: LET_KW@0..4 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@4..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(" ")] diff --git a/crates/rome_js_parser/test_data/inline/err/array_expr_incomplete.rast b/crates/rome_js_parser/test_data/inline/err/array_expr_incomplete.rast index dfd7946278f..782e91d3432 100644 --- a/crates/rome_js_parser/test_data/inline/err/array_expr_incomplete.rast +++ b/crates/rome_js_parser/test_data/inline/err/array_expr_incomplete.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@0..4 "let" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -34,8 +35,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..9 0: JS_VARIABLE_STATEMENT@0..9 0: JS_VARIABLE_DECLARATION@0..9 - 0: LET_KW@0..4 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@4..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(" ")] diff --git a/crates/rome_js_parser/test_data/inline/err/async_arrow_expr_await_parameter.rast b/crates/rome_js_parser/test_data/inline/err/async_arrow_expr_await_parameter.rast index efcf724c491..97293d1391d 100644 --- a/crates/rome_js_parser/test_data/inline/err/async_arrow_expr_await_parameter.rast +++ b/crates/rome_js_parser/test_data/inline/err/async_arrow_expr_await_parameter.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@0..4 "let" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -169,8 +170,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..96 0: JS_VARIABLE_STATEMENT@0..25 0: JS_VARIABLE_DECLARATION@0..25 - 0: LET_KW@0..4 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@4..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(" ")] diff --git a/crates/rome_js_parser/test_data/inline/err/await_in_module.rast b/crates/rome_js_parser/test_data/inline/err/await_in_module.rast index bdb127cc508..abc0d69b840 100644 --- a/crates/rome_js_parser/test_data/inline/err/await_in_module.rast +++ b/crates/rome_js_parser/test_data/inline/err/await_in_module.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@0..4 "let" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -62,8 +63,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..35 0: JS_VARIABLE_STATEMENT@0..15 0: JS_VARIABLE_DECLARATION@0..14 - 0: LET_KW@0..4 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@4..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(" ")] diff --git a/crates/rome_js_parser/test_data/inline/err/await_using_declaration_only_allowed_inside_an_async_function.js b/crates/rome_js_parser/test_data/inline/err/await_using_declaration_only_allowed_inside_an_async_function.js new file mode 100644 index 00000000000..c10c2733f77 --- /dev/null +++ b/crates/rome_js_parser/test_data/inline/err/await_using_declaration_only_allowed_inside_an_async_function.js @@ -0,0 +1,3 @@ +function foo() { await using x = y }; +foo = function() { await using x = y }; +foo = () => { await using x = y }; diff --git a/crates/rome_js_parser/test_data/inline/err/await_using_declaration_only_allowed_inside_an_async_function.rast b/crates/rome_js_parser/test_data/inline/err/await_using_declaration_only_allowed_inside_an_async_function.rast new file mode 100644 index 00000000000..9a2021254b1 --- /dev/null +++ b/crates/rome_js_parser/test_data/inline/err/await_using_declaration_only_allowed_inside_an_async_function.rast @@ -0,0 +1,311 @@ +JsModule { + 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: JS_DIRECTIVE_LIST@0..0 + 2: 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 ";" [] [] + 3: 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/rome_js_parser/test_data/inline/err/binding_identifier_invalid.rast b/crates/rome_js_parser/test_data/inline/err/binding_identifier_invalid.rast index 4441932f348..e98f322e508 100644 --- a/crates/rome_js_parser/test_data/inline/err/binding_identifier_invalid.rast +++ b/crates/rome_js_parser/test_data/inline/err/binding_identifier_invalid.rast @@ -19,6 +19,7 @@ JsModule { statements: JsStatementList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@14..18 "let" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -65,6 +66,7 @@ JsModule { statements: JsStatementList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@48..56 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -91,6 +93,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@68..73 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -113,6 +116,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@82..87 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -135,6 +139,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: CONST_KW@95..102 "const" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -157,6 +162,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@110..115 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -204,8 +210,9 @@ JsModule { 2: JS_STATEMENT_LIST@14..29 0: JS_VARIABLE_STATEMENT@14..29 0: JS_VARIABLE_DECLARATION@14..27 - 0: LET_KW@14..18 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@18..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(" ")] @@ -235,8 +242,9 @@ JsModule { 2: JS_STATEMENT_LIST@48..66 0: JS_VARIABLE_STATEMENT@48..66 0: JS_VARIABLE_DECLARATION@48..65 - 0: LET_KW@48..56 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@56..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(" ")] @@ -249,8 +257,9 @@ JsModule { 3: R_CURLY@66..68 "}" [Newline("\n")] [] 2: JS_VARIABLE_STATEMENT@68..82 0: JS_VARIABLE_DECLARATION@68..81 - 0: LET_KW@68..73 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@73..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(" ")] @@ -262,8 +271,9 @@ JsModule { 1: SEMICOLON@81..82 ";" [] [] 3: JS_VARIABLE_STATEMENT@82..95 0: JS_VARIABLE_DECLARATION@82..94 - 0: LET_KW@82..87 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@87..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(" ")] @@ -275,8 +285,9 @@ JsModule { 1: SEMICOLON@94..95 ";" [] [] 4: JS_VARIABLE_STATEMENT@95..110 0: JS_VARIABLE_DECLARATION@95..109 - 0: CONST_KW@95..102 "const" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@102..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(" ")] @@ -288,8 +299,9 @@ JsModule { 1: SEMICOLON@109..110 ";" [] [] 5: JS_VARIABLE_STATEMENT@110..120 0: JS_VARIABLE_DECLARATION@110..119 - 0: LET_KW@110..115 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@115..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" [] [] diff --git a/crates/rome_js_parser/test_data/inline/err/binding_identifier_invalid_script.rast b/crates/rome_js_parser/test_data/inline/err/binding_identifier_invalid_script.rast index 1e57e04c4ff..ebc1079eea0 100644 --- a/crates/rome_js_parser/test_data/inline/err/binding_identifier_invalid_script.rast +++ b/crates/rome_js_parser/test_data/inline/err/binding_identifier_invalid_script.rast @@ -4,6 +4,7 @@ JsScript { statements: JsStatementList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@0..14 "let" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -26,6 +27,7 @@ JsScript { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: CONST_KW@22..29 "const" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -56,8 +58,9 @@ JsScript { 2: JS_STATEMENT_LIST@0..37 0: JS_VARIABLE_STATEMENT@0..22 0: JS_VARIABLE_DECLARATION@0..21 - 0: LET_KW@0..14 "let" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@14..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(" ")] @@ -69,8 +72,9 @@ JsScript { 1: SEMICOLON@21..22 ";" [] [] 1: JS_VARIABLE_STATEMENT@22..37 0: JS_VARIABLE_DECLARATION@22..36 - 0: CONST_KW@22..29 "const" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@29..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(" ")] diff --git a/crates/rome_js_parser/test_data/inline/err/debugger_stmt.rast b/crates/rome_js_parser/test_data/inline/err/debugger_stmt.rast index 681502634e9..0704c6927f1 100644 --- a/crates/rome_js_parser/test_data/inline/err/debugger_stmt.rast +++ b/crates/rome_js_parser/test_data/inline/err/debugger_stmt.rast @@ -29,6 +29,7 @@ JsModule { statements: JsStatementList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: VAR_KW@29..38 "var" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -86,8 +87,9 @@ JsModule { 1: JS_STATEMENT_LIST@29..58 0: JS_VARIABLE_STATEMENT@29..58 0: JS_VARIABLE_DECLARATION@29..57 - 0: VAR_KW@29..38 "var" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@38..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(" ")] diff --git a/crates/rome_js_parser/test_data/inline/err/decorator_class_declaration.rast b/crates/rome_js_parser/test_data/inline/err/decorator_class_declaration.rast index e7cc27b4329..fa3764138f6 100644 --- a/crates/rome_js_parser/test_data/inline/err/decorator_class_declaration.rast +++ b/crates/rome_js_parser/test_data/inline/err/decorator_class_declaration.rast @@ -34,6 +34,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@32..42 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -124,8 +125,9 @@ JsModule { 0: IDENT@23..32 "decorator" [] [] 1: JS_VARIABLE_STATEMENT@32..44 0: JS_VARIABLE_DECLARATION@32..43 - 0: LET_KW@32..42 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@42..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" [] [] diff --git a/crates/rome_js_parser/test_data/inline/err/decorator_class_declaration_top_level.rast b/crates/rome_js_parser/test_data/inline/err/decorator_class_declaration_top_level.rast index 77d4dc45f5b..b4db650a2cc 100644 --- a/crates/rome_js_parser/test_data/inline/err/decorator_class_declaration_top_level.rast +++ b/crates/rome_js_parser/test_data/inline/err/decorator_class_declaration_top_level.rast @@ -16,6 +16,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@10..15 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -86,8 +87,9 @@ JsModule { 0: IDENT@1..10 "decorator" [] [] 1: JS_VARIABLE_STATEMENT@10..17 0: JS_VARIABLE_DECLARATION@10..16 - 0: LET_KW@10..15 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@15..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" [] [] diff --git a/crates/rome_js_parser/test_data/inline/err/decorator_export_class_clause.rast b/crates/rome_js_parser/test_data/inline/err/decorator_export_class_clause.rast index 7cffc766315..a391e2b7c9e 100644 --- a/crates/rome_js_parser/test_data/inline/err/decorator_export_class_clause.rast +++ b/crates/rome_js_parser/test_data/inline/err/decorator_export_class_clause.rast @@ -19,6 +19,7 @@ JsModule { 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 { @@ -97,8 +98,9 @@ JsModule { 1: EXPORT_KW@10..18 "export" [Newline("\n")] [Whitespace(" ")] 2: JS_VARIABLE_DECLARATION_CLAUSE@18..24 0: JS_VARIABLE_DECLARATION@18..23 - 0: LET_KW@18..22 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@22..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" [] [] diff --git a/crates/rome_js_parser/test_data/inline/err/decorator_expression_class.rast b/crates/rome_js_parser/test_data/inline/err/decorator_expression_class.rast index a4f72217709..2c4c4ce303a 100644 --- a/crates/rome_js_parser/test_data/inline/err/decorator_expression_class.rast +++ b/crates/rome_js_parser/test_data/inline/err/decorator_expression_class.rast @@ -130,6 +130,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@69..74 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -265,8 +266,9 @@ JsModule { 3: R_CURLY@68..69 "}" [] [] 2: JS_VARIABLE_STATEMENT@69..101 0: JS_VARIABLE_DECLARATION@69..101 - 0: LET_KW@69..74 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@74..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(" ")] diff --git a/crates/rome_js_parser/test_data/inline/err/export_variable_clause_error.rast b/crates/rome_js_parser/test_data/inline/err/export_variable_clause_error.rast index 0464e6fcc65..d82b70f5f3b 100644 --- a/crates/rome_js_parser/test_data/inline/err/export_variable_clause_error.rast +++ b/crates/rome_js_parser/test_data/inline/err/export_variable_clause_error.rast @@ -7,6 +7,7 @@ JsModule { 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 { @@ -29,6 +30,7 @@ JsModule { 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 { @@ -48,6 +50,7 @@ JsModule { 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 { @@ -83,8 +86,9 @@ JsModule { 1: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] 2: JS_VARIABLE_DECLARATION_CLAUSE@7..16 0: JS_VARIABLE_DECLARATION@7..15 - 0: LET_KW@7..11 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@11..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(" ")] @@ -98,8 +102,9 @@ JsModule { 1: EXPORT_KW@16..24 "export" [Newline("\n")] [Whitespace(" ")] 2: JS_VARIABLE_DECLARATION_CLAUSE@24..32 0: JS_VARIABLE_DECLARATION@24..31 - 0: CONST_KW@24..30 "const" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@30..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" [] [] @@ -111,8 +116,9 @@ JsModule { 1: EXPORT_KW@32..40 "export" [Newline("\n")] [Whitespace(" ")] 2: JS_VARIABLE_DECLARATION_CLAUSE@40..49 0: JS_VARIABLE_DECLARATION@40..48 - 0: LET_KW@40..44 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@44..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" [] [] @@ -146,7 +152,7 @@ export_variable_clause_error.js:1:16 parse ━━━━━━━━━━━━ -- export_variable_clause_error.js:2:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - × Const var declarations must have an initialized value + × Const declarations must have an initialized value 1 │ export let a = ; > 2 │ export const b; diff --git a/crates/rome_js_parser/test_data/inline/err/for_in_and_of_initializer_loose_mode.rast b/crates/rome_js_parser/test_data/inline/err/for_in_and_of_initializer_loose_mode.rast index 7e65dc67b9f..54dbd3161f7 100644 --- a/crates/rome_js_parser/test_data/inline/err/for_in_and_of_initializer_loose_mode.rast +++ b/crates/rome_js_parser/test_data/inline/err/for_in_and_of_initializer_loose_mode.rast @@ -6,6 +6,7 @@ JsScript { 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 { @@ -37,6 +38,7 @@ JsScript { 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 { @@ -69,6 +71,7 @@ JsScript { 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 { @@ -101,6 +104,7 @@ JsScript { 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 { @@ -133,6 +137,7 @@ JsScript { 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 { @@ -172,8 +177,9 @@ JsScript { 0: FOR_KW@0..14 "for" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")] 1: L_PAREN@14..15 "(" [] [] 2: JS_FOR_VARIABLE_DECLARATION@15..25 - 0: LET_KW@15..19 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR@19..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) @@ -195,8 +201,9 @@ JsScript { 0: FOR_KW@34..39 "for" [Newline("\n")] [Whitespace(" ")] 1: L_PAREN@39..40 "(" [] [] 2: JS_FOR_VARIABLE_DECLARATION@40..52 - 0: CONST_KW@40..46 "const" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR@46..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) @@ -219,8 +226,9 @@ JsScript { 1: (empty) 2: L_PAREN@66..67 "(" [] [] 3: JS_FOR_VARIABLE_DECLARATION@67..77 - 0: VAR_KW@67..71 "var" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR@71..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) @@ -243,8 +251,9 @@ JsScript { 1: (empty) 2: L_PAREN@91..92 "(" [] [] 3: JS_FOR_VARIABLE_DECLARATION@92..102 - 0: LET_KW@92..96 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR@96..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) @@ -267,8 +276,9 @@ JsScript { 1: (empty) 2: L_PAREN@116..117 "(" [] [] 3: JS_FOR_VARIABLE_DECLARATION@117..129 - 0: CONST_KW@117..123 "const" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR@123..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) diff --git a/crates/rome_js_parser/test_data/inline/err/for_in_and_of_initializer_strict_mode.js b/crates/rome_js_parser/test_data/inline/err/for_in_and_of_initializer_strict_mode.js index 129386e4374..1fffd27347f 100644 --- a/crates/rome_js_parser/test_data/inline/err/for_in_and_of_initializer_strict_mode.js +++ b/crates/rome_js_parser/test_data/inline/err/for_in_and_of_initializer_strict_mode.js @@ -4,3 +4,7 @@ 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/rome_js_parser/test_data/inline/err/for_in_and_of_initializer_strict_mode.rast b/crates/rome_js_parser/test_data/inline/err/for_in_and_of_initializer_strict_mode.rast index 7590550b23e..63a8741974f 100644 --- a/crates/rome_js_parser/test_data/inline/err/for_in_and_of_initializer_strict_mode.rast +++ b/crates/rome_js_parser/test_data/inline/err/for_in_and_of_initializer_strict_mode.rast @@ -6,6 +6,7 @@ JsModule { 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 { @@ -37,6 +38,7 @@ JsModule { 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 { @@ -68,6 +70,7 @@ JsModule { 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 { @@ -100,6 +103,7 @@ JsModule { 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 { @@ -132,6 +136,7 @@ JsModule { 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 { @@ -164,6 +169,7 @@ JsModule { 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 { @@ -191,20 +197,173 @@ JsModule { 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@153..154 "" [Newline("\n")] [], + eof_token: EOF@285..286 "" [Newline("\n")] [], } -0: JS_MODULE@0..154 +0: JS_MODULE@0..286 0: (empty) 1: JS_DIRECTIVE_LIST@0..0 - 2: JS_MODULE_ITEM_LIST@0..153 + 2: 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: VAR_KW@5..9 "var" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR@9..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) @@ -226,8 +385,9 @@ JsModule { 0: FOR_KW@24..29 "for" [Newline("\n")] [Whitespace(" ")] 1: L_PAREN@29..30 "(" [] [] 2: JS_FOR_VARIABLE_DECLARATION@30..40 - 0: LET_KW@30..34 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR@34..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) @@ -249,8 +409,9 @@ JsModule { 0: FOR_KW@49..54 "for" [Newline("\n")] [Whitespace(" ")] 1: L_PAREN@54..55 "(" [] [] 2: JS_FOR_VARIABLE_DECLARATION@55..67 - 0: CONST_KW@55..61 "const" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR@61..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) @@ -273,8 +434,9 @@ JsModule { 1: (empty) 2: L_PAREN@81..82 "(" [] [] 3: JS_FOR_VARIABLE_DECLARATION@82..92 - 0: VAR_KW@82..86 "var" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR@86..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) @@ -297,8 +459,9 @@ JsModule { 1: (empty) 2: L_PAREN@106..107 "(" [] [] 3: JS_FOR_VARIABLE_DECLARATION@107..117 - 0: LET_KW@107..111 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR@111..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) @@ -321,8 +484,9 @@ JsModule { 1: (empty) 2: L_PAREN@131..132 "(" [] [] 3: JS_FOR_VARIABLE_DECLARATION@132..144 - 0: CONST_KW@132..138 "const" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR@138..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) @@ -340,7 +504,115 @@ JsModule { 0: L_CURLY@151..152 "{" [] [] 1: JS_STATEMENT_LIST@152..152 2: R_CURLY@152..153 "}" [] [] - 3: EOF@153..154 "" [Newline("\n")] [] + 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 ";" [] [] + 3: EOF@285..286 "" [Newline("\n")] [] -- for_in_and_of_initializer_strict_mode.js:1:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -396,7 +668,7 @@ for_in_and_of_initializer_strict_mode.js:5:12 parse ━━━━━━━━━ > 5 │ for (let i = 0 of []) {} │ ^^^ 6 │ for (const i = 0 of []) {} - 7 │ + 7 │ for (using x = y of z) {}; -- for_in_and_of_initializer_strict_mode.js:6:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -407,7 +679,55 @@ for_in_and_of_initializer_strict_mode.js:6:14 parse ━━━━━━━━━ 5 │ for (let i = 0 of []) {} > 6 │ for (const i = 0 of []) {} │ ^^^ - 7 │ + 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 []) {} @@ -416,3 +736,7 @@ 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/rome_js_parser/test_data/inline/err/for_of_async_identifier.rast b/crates/rome_js_parser/test_data/inline/err/for_of_async_identifier.rast index 4d513f68f32..52dea422ac5 100644 --- a/crates/rome_js_parser/test_data/inline/err/for_of_async_identifier.rast +++ b/crates/rome_js_parser/test_data/inline/err/for_of_async_identifier.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@0..4 "let" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -51,8 +52,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..31 0: JS_VARIABLE_STATEMENT@0..10 0: JS_VARIABLE_DECLARATION@0..9 - 0: LET_KW@0..4 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@4..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" [] [] diff --git a/crates/rome_js_parser/test_data/inline/err/for_stmt_err.rast b/crates/rome_js_parser/test_data/inline/err/for_stmt_err.rast index f8e017637df..67bc66d7ec6 100644 --- a/crates/rome_js_parser/test_data/inline/err/for_stmt_err.rast +++ b/crates/rome_js_parser/test_data/inline/err/for_stmt_err.rast @@ -19,6 +19,7 @@ JsModule { 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 { @@ -66,6 +67,7 @@ JsModule { 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 { @@ -174,6 +176,7 @@ JsModule { 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 { @@ -203,6 +206,7 @@ JsModule { 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 { @@ -250,6 +254,7 @@ JsModule { 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 { @@ -302,8 +307,9 @@ JsModule { 0: FOR_KW@9..14 "for" [Newline("\n")] [Whitespace(" ")] 1: (empty) 2: JS_VARIABLE_DECLARATION@14..23 - 0: LET_KW@14..18 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@18..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(" ")] @@ -334,8 +340,9 @@ JsModule { 0: FOR_KW@39..44 "for" [Newline("\n")] [Whitespace(" ")] 1: (empty) 2: JS_VARIABLE_DECLARATION@44..53 - 0: LET_KW@44..48 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@48..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(" ")] @@ -410,8 +417,9 @@ JsModule { 1: AWAIT_KW@117..123 "await" [] [Whitespace(" ")] 2: L_PAREN@123..124 "(" [] [] 3: JS_FOR_VARIABLE_DECLARATION@124..130 - 0: LET_KW@124..128 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR@128..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) @@ -431,8 +439,9 @@ JsModule { 1: AWAIT_KW@144..150 "await" [] [Whitespace(" ")] 2: L_PAREN@150..151 "(" [] [] 3: JS_VARIABLE_DECLARATION@151..160 - 0: LET_KW@151..155 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@155..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(" ")] @@ -463,8 +472,9 @@ JsModule { 0: FOR_KW@177..182 "for" [Newline("\n")] [Whitespace(" ")] 1: L_PAREN@182..183 "(" [] [] 2: JS_VARIABLE_DECLARATION@183..190 - 0: LET_KW@183..187 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@187..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 "[" [] [] diff --git a/crates/rome_js_parser/test_data/inline/err/import_keyword_in_expression_position.rast b/crates/rome_js_parser/test_data/inline/err/import_keyword_in_expression_position.rast index f9d1f830e1a..ca6409979f8 100644 --- a/crates/rome_js_parser/test_data/inline/err/import_keyword_in_expression_position.rast +++ b/crates/rome_js_parser/test_data/inline/err/import_keyword_in_expression_position.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@0..4 "let" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -35,8 +36,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..15 0: JS_VARIABLE_STATEMENT@0..8 0: JS_VARIABLE_DECLARATION@0..8 - 0: LET_KW@0..4 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@4..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(" ")] diff --git a/crates/rome_js_parser/test_data/inline/err/invalid_arg_list.rast b/crates/rome_js_parser/test_data/inline/err/invalid_arg_list.rast index 2e9a592a792..9ab4f2816a3 100644 --- a/crates/rome_js_parser/test_data/inline/err/invalid_arg_list.rast +++ b/crates/rome_js_parser/test_data/inline/err/invalid_arg_list.rast @@ -34,6 +34,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@24..29 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -222,8 +223,9 @@ JsModule { 3: R_CURLY@23..24 "}" [] [] 1: JS_VARIABLE_STATEMENT@24..37 0: JS_VARIABLE_DECLARATION@24..36 - 0: LET_KW@24..29 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@29..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" [] [] diff --git a/crates/rome_js_parser/test_data/inline/err/invalid_method_recover.rast b/crates/rome_js_parser/test_data/inline/err/invalid_method_recover.rast index fddc0c65605..2b4fe38733d 100644 --- a/crates/rome_js_parser/test_data/inline/err/invalid_method_recover.rast +++ b/crates/rome_js_parser/test_data/inline/err/invalid_method_recover.rast @@ -46,6 +46,7 @@ JsModule { statements: JsStatementList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@27..36 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -122,8 +123,9 @@ JsModule { 2: JS_STATEMENT_LIST@27..39 0: JS_VARIABLE_STATEMENT@27..39 0: JS_VARIABLE_DECLARATION@27..38 - 0: LET_KW@27..36 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@36..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" [] [] diff --git a/crates/rome_js_parser/test_data/inline/err/invalid_using_declarations_inside_for_statement.js b/crates/rome_js_parser/test_data/inline/err/invalid_using_declarations_inside_for_statement.js new file mode 100644 index 00000000000..8df5eb86ab5 --- /dev/null +++ b/crates/rome_js_parser/test_data/inline/err/invalid_using_declarations_inside_for_statement.js @@ -0,0 +1,2 @@ +for (await using of x) {}; +for await (await using of x) {}; diff --git a/crates/rome_js_parser/test_data/inline/err/invalid_using_declarations_inside_for_statement.rast b/crates/rome_js_parser/test_data/inline/err/invalid_using_declarations_inside_for_statement.rast new file mode 100644 index 00000000000..524507495ed --- /dev/null +++ b/crates/rome_js_parser/test_data/inline/err/invalid_using_declarations_inside_for_statement.rast @@ -0,0 +1,228 @@ +JsModule { + 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: JS_DIRECTIVE_LIST@0..0 + 2: 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 ";" [] [] + 3: 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/rome_js_parser/test_data/inline/err/jsx_or_type_assertion.rast b/crates/rome_js_parser/test_data/inline/err/jsx_or_type_assertion.rast index 34d231519c4..3c359e6cfb8 100644 --- a/crates/rome_js_parser/test_data/inline/err/jsx_or_type_assertion.rast +++ b/crates/rome_js_parser/test_data/inline/err/jsx_or_type_assertion.rast @@ -22,6 +22,7 @@ JsScript { statements: JsStatementList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@24..33 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -70,6 +71,7 @@ JsScript { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@57..66 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -101,6 +103,7 @@ JsScript { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@98..107 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -148,6 +151,7 @@ JsScript { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@143..152 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -188,6 +192,7 @@ JsScript { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@248..257 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -253,8 +258,9 @@ JsScript { 2: JS_STATEMENT_LIST@24..281 0: JS_VARIABLE_STATEMENT@24..57 0: JS_VARIABLE_DECLARATION@24..57 - 0: LET_KW@24..33 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@33..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(" ")] @@ -283,8 +289,9 @@ JsScript { 1: (empty) 1: JS_VARIABLE_STATEMENT@57..98 0: JS_VARIABLE_DECLARATION@57..79 - 0: LET_KW@57..66 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@66..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(" ")] @@ -302,8 +309,9 @@ JsScript { 1: SEMICOLON@79..98 ";" [] [Whitespace(" "), Comments("// type assertion")] 2: JS_VARIABLE_STATEMENT@98..143 0: JS_VARIABLE_DECLARATION@98..124 - 0: LET_KW@98..107 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@107..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(" ")] @@ -331,8 +339,9 @@ JsScript { 1: SEMICOLON@124..143 ";" [] [Whitespace(" "), Comments("// type assertion")] 3: JS_VARIABLE_STATEMENT@143..248 0: JS_VARIABLE_DECLARATION@143..169 - 0: LET_KW@143..152 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@152..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(" ")] @@ -356,8 +365,9 @@ JsScript { 1: SEMICOLON@169..248 ";" [] [Whitespace(" "), Comments("// ambiguous: JSX or ...")] 4: JS_VARIABLE_STATEMENT@248..281 0: JS_VARIABLE_DECLARATION@248..280 - 0: LET_KW@248..257 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@257..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(" ")] diff --git a/crates/rome_js_parser/test_data/inline/err/jsx_spread_attribute_error.rast b/crates/rome_js_parser/test_data/inline/err/jsx_spread_attribute_error.rast index 3844430f394..0eeda438d65 100644 --- a/crates/rome_js_parser/test_data/inline/err/jsx_spread_attribute_error.rast +++ b/crates/rome_js_parser/test_data/inline/err/jsx_spread_attribute_error.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@0..4 "let" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -159,8 +160,9 @@ JsModule { 2: 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: (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(" ")] diff --git a/crates/rome_js_parser/test_data/inline/err/let_array_with_new_line.rast b/crates/rome_js_parser/test_data/inline/err/let_array_with_new_line.rast index 6afc9f31de3..eabfda787e6 100644 --- a/crates/rome_js_parser/test_data/inline/err/let_array_with_new_line.rast +++ b/crates/rome_js_parser/test_data/inline/err/let_array_with_new_line.rast @@ -8,6 +8,7 @@ JsScript { body: JsBogusStatement { items: [ JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@13..16 "let" [] [], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -47,8 +48,9 @@ JsScript { 1: COLON@11..13 ":" [] [Whitespace(" ")] 2: JS_BOGUS_STATEMENT@13..25 0: JS_VARIABLE_DECLARATION@13..24 - 0: LET_KW@13..16 "let" [] [] - 1: JS_VARIABLE_DECLARATOR_LIST@16..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")] [] diff --git a/crates/rome_js_parser/test_data/inline/err/let_newline_in_async_function.rast b/crates/rome_js_parser/test_data/inline/err/let_newline_in_async_function.rast index bc4d8ccb2e9..2cb12047b68 100644 --- a/crates/rome_js_parser/test_data/inline/err/let_newline_in_async_function.rast +++ b/crates/rome_js_parser/test_data/inline/err/let_newline_in_async_function.rast @@ -22,6 +22,7 @@ JsModule { statements: JsStatementList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@20..26 "let" [Newline("\n"), Whitespace(" ")] [], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -73,8 +74,9 @@ JsModule { 2: JS_STATEMENT_LIST@20..37 0: JS_VARIABLE_STATEMENT@20..35 0: JS_VARIABLE_DECLARATION@20..35 - 0: LET_KW@20..26 "let" [Newline("\n"), Whitespace(" ")] [] - 1: JS_VARIABLE_DECLARATOR_LIST@26..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(" ")] diff --git a/crates/rome_js_parser/test_data/inline/err/lexical_declaration_in_single_statement_context.rast b/crates/rome_js_parser/test_data/inline/err/lexical_declaration_in_single_statement_context.rast index 878e0eb42b8..61cc673f617 100644 --- a/crates/rome_js_parser/test_data/inline/err/lexical_declaration_in_single_statement_context.rast +++ b/crates/rome_js_parser/test_data/inline/err/lexical_declaration_in_single_statement_context.rast @@ -12,6 +12,7 @@ JsModule { consequent: JsBogusStatement { items: [ JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@10..14 "let" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -38,6 +39,7 @@ JsModule { body: JsBogusStatement { items: [ JsVariableDeclaration { + await_token: missing (optional), kind: CONST_KW@30..36 "const" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -74,8 +76,9 @@ JsModule { 3: R_PAREN@8..10 ")" [] [Whitespace(" ")] 4: JS_BOGUS_STATEMENT@10..16 0: JS_VARIABLE_DECLARATION@10..15 - 0: LET_KW@10..14 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@14..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" [] [] @@ -91,8 +94,9 @@ JsModule { 3: R_PAREN@28..30 ")" [] [Whitespace(" ")] 4: JS_BOGUS_STATEMENT@30..42 0: JS_VARIABLE_DECLARATION@30..41 - 0: CONST_KW@30..36 "const" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@36..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(" ")] diff --git a/crates/rome_js_parser/test_data/inline/err/object_binding_pattern.rast b/crates/rome_js_parser/test_data/inline/err/object_binding_pattern.rast index 9754057e2a7..fd6feb4ec0c 100644 --- a/crates/rome_js_parser/test_data/inline/err/object_binding_pattern.rast +++ b/crates/rome_js_parser/test_data/inline/err/object_binding_pattern.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@0..4 "let" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -55,6 +56,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@30..35 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -98,6 +100,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@62..67 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -150,6 +153,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@94..99 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -200,8 +204,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..124 0: JS_VARIABLE_STATEMENT@0..10 0: JS_VARIABLE_DECLARATION@0..10 - 0: LET_KW@0..4 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@4..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(" ")] @@ -234,8 +239,9 @@ JsModule { 0: SEMICOLON@29..30 ";" [] [] 4: JS_VARIABLE_STATEMENT@30..62 0: JS_VARIABLE_DECLARATION@30..61 - 0: LET_KW@30..35 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@35..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(" ")] @@ -261,8 +267,9 @@ JsModule { 1: SEMICOLON@61..62 ";" [] [] 5: JS_VARIABLE_STATEMENT@62..94 0: JS_VARIABLE_DECLARATION@62..93 - 0: LET_KW@62..67 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@67..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(" ")] @@ -297,8 +304,9 @@ JsModule { 1: SEMICOLON@93..94 ";" [] [] 6: JS_VARIABLE_STATEMENT@94..124 0: JS_VARIABLE_DECLARATION@94..123 - 0: LET_KW@94..99 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@99..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(" ")] diff --git a/crates/rome_js_parser/test_data/inline/err/object_expr_err.rast b/crates/rome_js_parser/test_data/inline/err/object_expr_err.rast index 6db707fd744..44e03e0ea20 100644 --- a/crates/rome_js_parser/test_data/inline/err/object_expr_err.rast +++ b/crates/rome_js_parser/test_data/inline/err/object_expr_err.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@0..4 "let" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -34,6 +35,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@15..20 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -68,6 +70,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@35..40 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -104,8 +107,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..49 0: JS_VARIABLE_STATEMENT@0..15 0: JS_VARIABLE_DECLARATION@0..15 - 0: LET_KW@0..4 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@4..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(" ")] @@ -124,8 +128,9 @@ JsModule { 1: (empty) 1: JS_VARIABLE_STATEMENT@15..35 0: JS_VARIABLE_DECLARATION@15..35 - 0: LET_KW@15..20 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@20..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(" ")] @@ -146,8 +151,9 @@ JsModule { 1: (empty) 2: JS_VARIABLE_STATEMENT@35..49 0: JS_VARIABLE_DECLARATION@35..49 - 0: LET_KW@35..40 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@40..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(" ")] diff --git a/crates/rome_js_parser/test_data/inline/err/object_expr_error_prop_name.rast b/crates/rome_js_parser/test_data/inline/err/object_expr_error_prop_name.rast index 0c31552a13d..283782feefb 100644 --- a/crates/rome_js_parser/test_data/inline/err/object_expr_error_prop_name.rast +++ b/crates/rome_js_parser/test_data/inline/err/object_expr_error_prop_name.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@0..4 "let" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -54,6 +55,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@26..31 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -95,8 +97,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..39 0: JS_VARIABLE_STATEMENT@0..26 0: JS_VARIABLE_DECLARATION@0..26 - 0: LET_KW@0..4 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@4..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(" ")] @@ -123,8 +126,9 @@ JsModule { 1: (empty) 1: JS_VARIABLE_STATEMENT@26..38 0: JS_VARIABLE_DECLARATION@26..38 - 0: LET_KW@26..31 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@31..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(" ")] diff --git a/crates/rome_js_parser/test_data/inline/err/object_expr_method.rast b/crates/rome_js_parser/test_data/inline/err/object_expr_method.rast index 2c03754951f..af73afb16be 100644 --- a/crates/rome_js_parser/test_data/inline/err/object_expr_method.rast +++ b/crates/rome_js_parser/test_data/inline/err/object_expr_method.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@0..4 "let" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -46,8 +47,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..16 0: JS_VARIABLE_STATEMENT@0..16 0: JS_VARIABLE_DECLARATION@0..16 - 0: LET_KW@0..4 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@4..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(" ")] diff --git a/crates/rome_js_parser/test_data/inline/err/object_expr_non_ident_literal_prop.rast b/crates/rome_js_parser/test_data/inline/err/object_expr_non_ident_literal_prop.rast index 2546a09c266..6408f4d3d62 100644 --- a/crates/rome_js_parser/test_data/inline/err/object_expr_non_ident_literal_prop.rast +++ b/crates/rome_js_parser/test_data/inline/err/object_expr_non_ident_literal_prop.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@0..4 "let" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -42,8 +43,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..11 0: JS_VARIABLE_STATEMENT@0..11 0: JS_VARIABLE_DECLARATION@0..11 - 0: LET_KW@0..4 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@4..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(" ")] diff --git a/crates/rome_js_parser/test_data/inline/err/object_expr_setter.rast b/crates/rome_js_parser/test_data/inline/err/object_expr_setter.rast index d8e0a3c0b8f..e45836ce017 100644 --- a/crates/rome_js_parser/test_data/inline/err/object_expr_setter.rast +++ b/crates/rome_js_parser/test_data/inline/err/object_expr_setter.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@0..4 "let" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -58,8 +59,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..41 0: JS_VARIABLE_STATEMENT@0..41 0: JS_VARIABLE_DECLARATION@0..41 - 0: LET_KW@0..4 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@4..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(" ")] diff --git a/crates/rome_js_parser/test_data/inline/err/object_property_binding_err.rast b/crates/rome_js_parser/test_data/inline/err/object_property_binding_err.rast index 50893cabc92..2c219f3f2ff 100644 --- a/crates/rome_js_parser/test_data/inline/err/object_property_binding_err.rast +++ b/crates/rome_js_parser/test_data/inline/err/object_property_binding_err.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@0..4 "let" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -44,6 +45,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@23..28 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -82,6 +84,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@53..58 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -127,8 +130,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..80 0: JS_VARIABLE_STATEMENT@0..23 0: JS_VARIABLE_DECLARATION@0..23 - 0: LET_KW@0..4 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@4..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(" ")] @@ -155,8 +159,9 @@ JsModule { 1: (empty) 1: JS_VARIABLE_STATEMENT@23..53 0: JS_VARIABLE_DECLARATION@23..53 - 0: LET_KW@23..28 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@28..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(" ")] @@ -181,8 +186,9 @@ JsModule { 1: (empty) 2: JS_VARIABLE_STATEMENT@53..80 0: JS_VARIABLE_DECLARATION@53..80 - 0: LET_KW@53..58 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@58..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(" ")] diff --git a/crates/rome_js_parser/test_data/inline/err/object_shorthand_property_err.rast b/crates/rome_js_parser/test_data/inline/err/object_shorthand_property_err.rast index 90ac110fd52..4381158927c 100644 --- a/crates/rome_js_parser/test_data/inline/err/object_shorthand_property_err.rast +++ b/crates/rome_js_parser/test_data/inline/err/object_shorthand_property_err.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@0..4 "let" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -42,6 +43,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@15..20 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -76,6 +78,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@36..41 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -117,8 +120,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..52 0: JS_VARIABLE_STATEMENT@0..15 0: JS_VARIABLE_DECLARATION@0..15 - 0: LET_KW@0..4 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@4..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(" ")] @@ -142,8 +146,9 @@ JsModule { 1: (empty) 1: JS_VARIABLE_STATEMENT@15..36 0: JS_VARIABLE_DECLARATION@15..36 - 0: LET_KW@15..20 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@20..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(" ")] @@ -164,8 +169,9 @@ JsModule { 1: (empty) 2: JS_VARIABLE_STATEMENT@36..52 0: JS_VARIABLE_DECLARATION@36..52 - 0: LET_KW@36..41 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@41..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(" ")] diff --git a/crates/rome_js_parser/test_data/inline/err/optional_chain_call_without_arguments.rast b/crates/rome_js_parser/test_data/inline/err/optional_chain_call_without_arguments.rast index ad8d98a442c..d5b0c4ce0a9 100644 --- a/crates/rome_js_parser/test_data/inline/err/optional_chain_call_without_arguments.rast +++ b/crates/rome_js_parser/test_data/inline/err/optional_chain_call_without_arguments.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@0..4 "let" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -88,8 +89,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..46 0: JS_VARIABLE_STATEMENT@0..23 0: JS_VARIABLE_DECLARATION@0..22 - 0: LET_KW@0..4 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@4..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(" ")] diff --git a/crates/rome_js_parser/test_data/inline/err/rest_property_binding_err.rast b/crates/rome_js_parser/test_data/inline/err/rest_property_binding_err.rast index c44ce23b43b..a0f9bdb144d 100644 --- a/crates/rome_js_parser/test_data/inline/err/rest_property_binding_err.rast +++ b/crates/rome_js_parser/test_data/inline/err/rest_property_binding_err.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@0..4 "let" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -79,6 +80,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@46..51 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -235,6 +237,7 @@ JsModule { statements: JsStatementList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@152..159 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -280,8 +283,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..178 0: JS_VARIABLE_STATEMENT@0..16 0: JS_VARIABLE_DECLARATION@0..15 - 0: LET_KW@0..4 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@4..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(" ")] @@ -320,8 +324,9 @@ JsModule { 1: SEMICOLON@45..46 ";" [] [] 2: JS_VARIABLE_STATEMENT@46..66 0: JS_VARIABLE_DECLARATION@46..65 - 0: LET_KW@46..51 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@51..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(" ")] @@ -406,8 +411,9 @@ JsModule { 2: JS_STATEMENT_LIST@152..176 0: JS_VARIABLE_STATEMENT@152..176 0: JS_VARIABLE_DECLARATION@152..175 - 0: LET_KW@152..159 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@159..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(" ")] diff --git a/crates/rome_js_parser/test_data/inline/err/semicolons_err.rast b/crates/rome_js_parser/test_data/inline/err/semicolons_err.rast index a85c274b752..2112f8a1afe 100644 --- a/crates/rome_js_parser/test_data/inline/err/semicolons_err.rast +++ b/crates/rome_js_parser/test_data/inline/err/semicolons_err.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@0..4 "let" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -43,8 +44,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..23 0: JS_VARIABLE_STATEMENT@0..14 0: JS_VARIABLE_DECLARATION@0..14 - 0: LET_KW@0..4 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@4..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(" ")] diff --git a/crates/rome_js_parser/test_data/inline/err/template_literal.rast b/crates/rome_js_parser/test_data/inline/err/template_literal.rast index e1add272dd7..139b5a8bef6 100644 --- a/crates/rome_js_parser/test_data/inline/err/template_literal.rast +++ b/crates/rome_js_parser/test_data/inline/err/template_literal.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@0..4 "let" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -37,6 +38,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@17..22 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -88,8 +90,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..34 0: JS_VARIABLE_STATEMENT@0..17 0: JS_VARIABLE_DECLARATION@0..17 - 0: LET_KW@0..4 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@4..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(" ")] @@ -111,8 +114,9 @@ JsModule { 1: (empty) 1: JS_VARIABLE_STATEMENT@17..34 0: JS_VARIABLE_DECLARATION@17..34 - 0: LET_KW@17..22 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@22..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(" ")] diff --git a/crates/rome_js_parser/test_data/inline/err/template_literal_unterminated.rast b/crates/rome_js_parser/test_data/inline/err/template_literal_unterminated.rast index 32dd8d71962..c0d4fe81287 100644 --- a/crates/rome_js_parser/test_data/inline/err/template_literal_unterminated.rast +++ b/crates/rome_js_parser/test_data/inline/err/template_literal_unterminated.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@0..4 "let" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -49,8 +50,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..20 0: JS_VARIABLE_STATEMENT@0..20 0: JS_VARIABLE_DECLARATION@0..20 - 0: LET_KW@0..4 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@4..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(" ")] diff --git a/crates/rome_js_parser/test_data/inline/err/ts_arrow_function_this_parameter.rast b/crates/rome_js_parser/test_data/inline/err/ts_arrow_function_this_parameter.rast index 8d761757419..ed95a068b08 100644 --- a/crates/rome_js_parser/test_data/inline/err/ts_arrow_function_this_parameter.rast +++ b/crates/rome_js_parser/test_data/inline/err/ts_arrow_function_this_parameter.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@0..4 "let" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -58,8 +59,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..28 0: JS_VARIABLE_STATEMENT@0..28 0: JS_VARIABLE_DECLARATION@0..28 - 0: LET_KW@0..4 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@4..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(" ")] diff --git a/crates/rome_js_parser/test_data/inline/err/ts_as_assignment_no_parenthesize.rast b/crates/rome_js_parser/test_data/inline/err/ts_as_assignment_no_parenthesize.rast index d8011e6cde2..6e6b34988cb 100644 --- a/crates/rome_js_parser/test_data/inline/err/ts_as_assignment_no_parenthesize.rast +++ b/crates/rome_js_parser/test_data/inline/err/ts_as_assignment_no_parenthesize.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@0..4 "let" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -106,8 +107,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..79 0: JS_VARIABLE_STATEMENT@0..11 0: JS_VARIABLE_DECLARATION@0..10 - 0: LET_KW@0..4 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@4..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" [] [] diff --git a/crates/rome_js_parser/test_data/inline/err/ts_decorator_on_arrow_function.rast b/crates/rome_js_parser/test_data/inline/err/ts_decorator_on_arrow_function.rast index 79fd9c8434b..5731cd1115b 100644 --- a/crates/rome_js_parser/test_data/inline/err/ts_decorator_on_arrow_function.rast +++ b/crates/rome_js_parser/test_data/inline/err/ts_decorator_on_arrow_function.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: CONST_KW@0..6 "const" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -94,6 +95,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: CONST_KW@62..69 "const" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -214,6 +216,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: CONST_KW@135..142 "const" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -330,8 +333,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..202 0: JS_VARIABLE_STATEMENT@0..62 0: JS_VARIABLE_DECLARATION@0..61 - 0: CONST_KW@0..6 "const" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@6..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(" ")] @@ -386,8 +390,9 @@ JsModule { 1: SEMICOLON@61..62 ";" [] [] 1: JS_VARIABLE_STATEMENT@62..135 0: JS_VARIABLE_DECLARATION@62..134 - 0: CONST_KW@62..69 "const" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@69..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(" ")] @@ -464,8 +469,9 @@ JsModule { 1: SEMICOLON@134..135 ";" [] [] 2: JS_VARIABLE_STATEMENT@135..202 0: JS_VARIABLE_DECLARATION@135..201 - 0: CONST_KW@135..142 "const" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@142..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(" ")] diff --git a/crates/rome_js_parser/test_data/inline/err/ts_decorator_on_function_expression.rast b/crates/rome_js_parser/test_data/inline/err/ts_decorator_on_function_expression.rast index ea03ec1a26e..3be99f3f381 100644 --- a/crates/rome_js_parser/test_data/inline/err/ts_decorator_on_function_expression.rast +++ b/crates/rome_js_parser/test_data/inline/err/ts_decorator_on_function_expression.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: CONST_KW@0..6 "const" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -98,6 +99,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: CONST_KW@71..78 "const" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -222,6 +224,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: CONST_KW@153..160 "const" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -342,8 +345,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..229 0: JS_VARIABLE_STATEMENT@0..71 0: JS_VARIABLE_DECLARATION@0..71 - 0: CONST_KW@0..6 "const" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@6..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(" ")] @@ -401,8 +405,9 @@ JsModule { 1: (empty) 1: JS_VARIABLE_STATEMENT@71..153 0: JS_VARIABLE_DECLARATION@71..153 - 0: CONST_KW@71..78 "const" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@78..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(" ")] @@ -482,8 +487,9 @@ JsModule { 1: (empty) 2: JS_VARIABLE_STATEMENT@153..229 0: JS_VARIABLE_DECLARATION@153..229 - 0: CONST_KW@153..160 "const" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@160..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(" ")] diff --git a/crates/rome_js_parser/test_data/inline/err/ts_export_syntax_in_js.rast b/crates/rome_js_parser/test_data/inline/err/ts_export_syntax_in_js.rast index 418568e91a6..5961c4d9910 100644 --- a/crates/rome_js_parser/test_data/inline/err/ts_export_syntax_in_js.rast +++ b/crates/rome_js_parser/test_data/inline/err/ts_export_syntax_in_js.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@0..4 "let" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -210,8 +211,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..171 0: JS_VARIABLE_STATEMENT@0..12 0: JS_VARIABLE_DECLARATION@0..11 - 0: LET_KW@0..4 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@4..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" [] [] diff --git a/crates/rome_js_parser/test_data/inline/err/ts_instantiation_expressions_1.rast b/crates/rome_js_parser/test_data/inline/err/ts_instantiation_expressions_1.rast index 440ac59a6a7..1ff3ed4183a 100644 --- a/crates/rome_js_parser/test_data/inline/err/ts_instantiation_expressions_1.rast +++ b/crates/rome_js_parser/test_data/inline/err/ts_instantiation_expressions_1.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: CONST_KW@0..6 "const" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -45,6 +46,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: CONST_KW@59..66 "const" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -707,6 +709,7 @@ JsModule { 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 { @@ -763,8 +766,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..401 0: JS_VARIABLE_STATEMENT@0..59 0: JS_VARIABLE_DECLARATION@0..28 - 0: CONST_KW@0..6 "const" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@6..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(" ")] @@ -790,8 +794,9 @@ JsModule { 1: SEMICOLON@28..59 ";" [] [Whitespace(" "), Comments("// Relational operato ...")] 1: JS_VARIABLE_STATEMENT@59..107 0: JS_VARIABLE_DECLARATION@59..82 - 0: CONST_KW@59..66 "const" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@66..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(" ")] @@ -1216,8 +1221,9 @@ JsModule { 0: FOR_KW@361..366 "for" [Newline("\n")] [Whitespace(" ")] 1: L_PAREN@366..367 "(" [] [] 2: JS_FOR_VARIABLE_DECLARATION@367..392 - 0: CONST_KW@367..373 "const" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR@373..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) diff --git a/crates/rome_js_parser/test_data/inline/err/ts_satisfies_assignment_no_parenthesize.rast b/crates/rome_js_parser/test_data/inline/err/ts_satisfies_assignment_no_parenthesize.rast index a856f9714ab..49f4092a47a 100644 --- a/crates/rome_js_parser/test_data/inline/err/ts_satisfies_assignment_no_parenthesize.rast +++ b/crates/rome_js_parser/test_data/inline/err/ts_satisfies_assignment_no_parenthesize.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@0..4 "let" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -83,8 +84,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..77 0: JS_VARIABLE_STATEMENT@0..11 0: JS_VARIABLE_DECLARATION@0..10 - 0: LET_KW@0..4 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@4..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" [] [] diff --git a/crates/rome_js_parser/test_data/inline/err/ts_satisfies_expression.rast b/crates/rome_js_parser/test_data/inline/err/ts_satisfies_expression.rast index 71848365d6b..f8666ec28e7 100644 --- a/crates/rome_js_parser/test_data/inline/err/ts_satisfies_expression.rast +++ b/crates/rome_js_parser/test_data/inline/err/ts_satisfies_expression.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@0..4 "let" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -40,8 +41,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..33 0: JS_VARIABLE_STATEMENT@0..33 0: JS_VARIABLE_DECLARATION@0..32 - 0: LET_KW@0..4 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@4..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(" ")] diff --git a/crates/rome_js_parser/test_data/inline/err/ts_type_assertions_not_valid_at_new_expr.rast b/crates/rome_js_parser/test_data/inline/err/ts_type_assertions_not_valid_at_new_expr.rast index 8407ccccc7d..3addfaa46a2 100644 --- a/crates/rome_js_parser/test_data/inline/err/ts_type_assertions_not_valid_at_new_expr.rast +++ b/crates/rome_js_parser/test_data/inline/err/ts_type_assertions_not_valid_at_new_expr.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: VAR_KW@0..4 "var" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -60,8 +61,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..29 0: JS_VARIABLE_STATEMENT@0..29 0: JS_VARIABLE_DECLARATION@0..28 - 0: VAR_KW@0..4 "var" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@4..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(" ")] diff --git a/crates/rome_js_parser/test_data/inline/err/ts_variable_annotation_err.rast b/crates/rome_js_parser/test_data/inline/err/ts_variable_annotation_err.rast index 51ef965cd39..8b09c1fadf5 100644 --- a/crates/rome_js_parser/test_data/inline/err/ts_variable_annotation_err.rast +++ b/crates/rome_js_parser/test_data/inline/err/ts_variable_annotation_err.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@0..4 "let" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -30,8 +31,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..7 0: JS_VARIABLE_STATEMENT@0..7 0: JS_VARIABLE_DECLARATION@0..6 - 0: LET_KW@0..4 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@4..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" [] [] diff --git a/crates/rome_js_parser/test_data/inline/err/type_parameter_modifier.rast b/crates/rome_js_parser/test_data/inline/err/type_parameter_modifier.rast index fde21eb511c..41dee4f8d2f 100644 --- a/crates/rome_js_parser/test_data/inline/err/type_parameter_modifier.rast +++ b/crates/rome_js_parser/test_data/inline/err/type_parameter_modifier.rast @@ -197,6 +197,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@135..140 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -238,6 +239,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@154..159 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -361,6 +363,7 @@ JsModule { 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 { @@ -405,6 +408,7 @@ JsModule { 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 { @@ -935,6 +939,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@523..528 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -989,6 +994,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@546..551 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -1043,6 +1049,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@570..575 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -1110,6 +1117,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@600..605 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -1165,6 +1173,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@627..632 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -1220,6 +1229,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@655..660 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -1288,6 +1298,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@689..694 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -1355,6 +1366,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@716..721 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -1422,6 +1434,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@744..749 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -2108,8 +2121,9 @@ JsModule { 3: R_CURLY@134..135 "}" [] [] 4: JS_VARIABLE_STATEMENT@135..154 0: JS_VARIABLE_DECLARATION@135..154 - 0: LET_KW@135..140 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@140..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" [] [] @@ -2135,8 +2149,9 @@ JsModule { 1: (empty) 5: JS_VARIABLE_STATEMENT@154..174 0: JS_VARIABLE_DECLARATION@154..174 - 0: LET_KW@154..159 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@159..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" [] [] @@ -2202,8 +2217,9 @@ JsModule { 0: DECLARE_KW@233..242 "declare" [Newline("\n")] [Whitespace(" ")] 1: JS_VARIABLE_DECLARATION_CLAUSE@242..260 0: JS_VARIABLE_DECLARATION@242..260 - 0: LET_KW@242..246 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@246..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" [] [] @@ -2231,8 +2247,9 @@ JsModule { 0: DECLARE_KW@260..269 "declare" [Newline("\n")] [Whitespace(" ")] 1: JS_VARIABLE_DECLARATION_CLAUSE@269..288 0: JS_VARIABLE_DECLARATION@269..288 - 0: LET_KW@269..273 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@273..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" [] [] @@ -2536,8 +2553,9 @@ JsModule { 1: SEMICOLON@522..523 ";" [] [] 19: JS_VARIABLE_STATEMENT@523..546 0: JS_VARIABLE_DECLARATION@523..545 - 0: LET_KW@523..528 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@528..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" [] [] @@ -2566,8 +2584,9 @@ JsModule { 1: SEMICOLON@545..546 ";" [] [] 20: JS_VARIABLE_STATEMENT@546..570 0: JS_VARIABLE_DECLARATION@546..569 - 0: LET_KW@546..551 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@551..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" [] [] @@ -2596,8 +2615,9 @@ JsModule { 1: SEMICOLON@569..570 ";" [] [] 21: JS_VARIABLE_STATEMENT@570..600 0: JS_VARIABLE_DECLARATION@570..599 - 0: LET_KW@570..575 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@575..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" [] [] @@ -2632,8 +2652,9 @@ JsModule { 1: SEMICOLON@599..600 ";" [] [] 22: JS_VARIABLE_STATEMENT@600..627 0: JS_VARIABLE_DECLARATION@600..626 - 0: LET_KW@600..605 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@605..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" [] [] @@ -2663,8 +2684,9 @@ JsModule { 1: SEMICOLON@626..627 ";" [] [] 23: JS_VARIABLE_STATEMENT@627..655 0: JS_VARIABLE_DECLARATION@627..654 - 0: LET_KW@627..632 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@632..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" [] [] @@ -2694,8 +2716,9 @@ JsModule { 1: SEMICOLON@654..655 ";" [] [] 24: JS_VARIABLE_STATEMENT@655..689 0: JS_VARIABLE_DECLARATION@655..688 - 0: LET_KW@655..660 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@660..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" [] [] @@ -2731,8 +2754,9 @@ JsModule { 1: SEMICOLON@688..689 ";" [] [] 25: JS_VARIABLE_STATEMENT@689..716 0: JS_VARIABLE_DECLARATION@689..715 - 0: LET_KW@689..694 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@694..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" [] [] @@ -2766,8 +2790,9 @@ JsModule { 1: SEMICOLON@715..716 ";" [] [] 26: JS_VARIABLE_STATEMENT@716..744 0: JS_VARIABLE_DECLARATION@716..743 - 0: LET_KW@716..721 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@721..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" [] [] @@ -2801,8 +2826,9 @@ JsModule { 1: SEMICOLON@743..744 ";" [] [] 27: JS_VARIABLE_STATEMENT@744..778 0: JS_VARIABLE_DECLARATION@744..777 - 0: LET_KW@744..749 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@749..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" [] [] diff --git a/crates/rome_js_parser/test_data/inline/err/using_declaration_not_allowed_in_for_in_statement.js b/crates/rome_js_parser/test_data/inline/err/using_declaration_not_allowed_in_for_in_statement.js new file mode 100644 index 00000000000..d4349aee076 --- /dev/null +++ b/crates/rome_js_parser/test_data/inline/err/using_declaration_not_allowed_in_for_in_statement.js @@ -0,0 +1,2 @@ +for (using x in y) {}; +for (await using x in y) {}; diff --git a/crates/rome_js_parser/test_data/inline/err/using_declaration_not_allowed_in_for_in_statement.rast b/crates/rome_js_parser/test_data/inline/err/using_declaration_not_allowed_in_for_in_statement.rast new file mode 100644 index 00000000000..ad4906cb8c9 --- /dev/null +++ b/crates/rome_js_parser/test_data/inline/err/using_declaration_not_allowed_in_for_in_statement.rast @@ -0,0 +1,140 @@ +JsModule { + 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: JS_DIRECTIVE_LIST@0..0 + 2: 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 ";" [] [] + 3: 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/rome_js_parser/test_data/inline/err/using_declaration_statement_err.js b/crates/rome_js_parser/test_data/inline/err/using_declaration_statement_err.js new file mode 100644 index 00000000000..41fa494f92e --- /dev/null +++ b/crates/rome_js_parser/test_data/inline/err/using_declaration_statement_err.js @@ -0,0 +1,10 @@ +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/rome_js_parser/test_data/inline/err/using_declaration_statement_err.rast b/crates/rome_js_parser/test_data/inline/err/using_declaration_statement_err.rast new file mode 100644 index 00000000000..4cae25c00fb --- /dev/null +++ b/crates/rome_js_parser/test_data/inline/err/using_declaration_statement_err.rast @@ -0,0 +1,647 @@ +JsModule { + 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: JS_DIRECTIVE_LIST@0..0 + 2: 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 ";" [] [] + 3: 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/rome_js_parser/test_data/inline/err/var_decl_err.rast b/crates/rome_js_parser/test_data/inline/err/var_decl_err.rast index 26411abf576..7ec7f9f6f8f 100644 --- a/crates/rome_js_parser/test_data/inline/err/var_decl_err.rast +++ b/crates/rome_js_parser/test_data/inline/err/var_decl_err.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: VAR_KW@0..4 "var" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -22,6 +23,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: CONST_KW@8..15 "const" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -42,6 +44,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@21..25 "let" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -70,8 +73,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..31 0: JS_VARIABLE_STATEMENT@0..8 0: JS_VARIABLE_DECLARATION@0..7 - 0: VAR_KW@0..4 "var" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@4..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(" ")] @@ -82,8 +86,9 @@ JsModule { 1: SEMICOLON@7..8 ";" [] [] 1: JS_VARIABLE_STATEMENT@8..21 0: JS_VARIABLE_DECLARATION@8..21 - 0: CONST_KW@8..15 "const" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@15..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(" ")] @@ -95,8 +100,9 @@ JsModule { 1: (empty) 2: JS_VARIABLE_STATEMENT@21..31 0: JS_VARIABLE_DECLARATION@21..30 - 0: LET_KW@21..25 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@25..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(" ")] diff --git a/crates/rome_js_parser/test_data/inline/err/variable_declaration_statement_err.rast b/crates/rome_js_parser/test_data/inline/err/variable_declaration_statement_err.rast index f42d3177f81..ee4b336c685 100644 --- a/crates/rome_js_parser/test_data/inline/err/variable_declaration_statement_err.rast +++ b/crates/rome_js_parser/test_data/inline/err/variable_declaration_statement_err.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@0..4 "let" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -53,6 +54,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: CONST_KW@24..31 "const" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -107,6 +109,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: CONST_KW@55..62 "const" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -122,6 +125,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@64..69 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -143,6 +147,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: CONST_KW@73..80 "const" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -175,8 +180,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..86 0: JS_VARIABLE_STATEMENT@0..24 0: JS_VARIABLE_DECLARATION@0..24 - 0: LET_KW@0..4 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@4..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" [] [] @@ -208,8 +214,9 @@ JsModule { 1: (empty) 1: JS_VARIABLE_STATEMENT@24..55 0: JS_VARIABLE_DECLARATION@24..55 - 0: CONST_KW@24..31 "const" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@31..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(" ")] @@ -244,8 +251,9 @@ JsModule { 1: (empty) 2: JS_VARIABLE_STATEMENT@55..64 0: JS_VARIABLE_DECLARATION@55..63 - 0: CONST_KW@55..62 "const" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@62..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" [] [] @@ -254,8 +262,9 @@ JsModule { 1: SEMICOLON@63..64 ";" [] [] 3: JS_VARIABLE_STATEMENT@64..73 0: JS_VARIABLE_DECLARATION@64..72 - 0: LET_KW@64..69 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@69..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 "[" [] [] @@ -268,8 +277,9 @@ JsModule { 1: SEMICOLON@72..73 ";" [] [] 4: JS_VARIABLE_STATEMENT@73..86 0: JS_VARIABLE_DECLARATION@73..85 - 0: CONST_KW@73..80 "const" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@80..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(" ")] @@ -286,7 +296,7 @@ JsModule { -- variable_declaration_statement_err.js:3:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - × Const var declarations must have an initialized value + × Const declarations must have an initialized value 1 │ let a, { b } = { a: 10 } 2 │ const c = 1, { d } = { a: 10 } diff --git a/crates/rome_js_parser/test_data/inline/err/variable_declarator_list_incomplete.rast b/crates/rome_js_parser/test_data/inline/err/variable_declarator_list_incomplete.rast index 035b2ff53a6..1454f95fc63 100644 --- a/crates/rome_js_parser/test_data/inline/err/variable_declarator_list_incomplete.rast +++ b/crates/rome_js_parser/test_data/inline/err/variable_declarator_list_incomplete.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: CONST_KW@0..6 "const" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -34,8 +35,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..12 0: JS_VARIABLE_STATEMENT@0..12 0: JS_VARIABLE_DECLARATION@0..12 - 0: CONST_KW@0..6 "const" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@6..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(" ")] diff --git a/crates/rome_js_parser/test_data/inline/ok/array_binding.rast b/crates/rome_js_parser/test_data/inline/ok/array_binding.rast index 958a813d7ea..badaf01679a 100644 --- a/crates/rome_js_parser/test_data/inline/ok/array_binding.rast +++ b/crates/rome_js_parser/test_data/inline/ok/array_binding.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@0..4 "let" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -24,6 +25,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@12..17 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -64,6 +66,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@33..38 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -103,6 +106,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@57..62 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -141,6 +145,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@85..90 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -178,6 +183,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@109..114 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -236,8 +242,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..138 0: JS_VARIABLE_STATEMENT@0..12 0: JS_VARIABLE_DECLARATION@0..11 - 0: LET_KW@0..4 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@4..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(" ")] @@ -249,8 +256,9 @@ JsModule { 1: SEMICOLON@11..12 ";" [] [] 1: JS_VARIABLE_STATEMENT@12..33 0: JS_VARIABLE_DECLARATION@12..32 - 0: LET_KW@12..17 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@17..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 "[" [] [] @@ -276,8 +284,9 @@ JsModule { 1: SEMICOLON@32..33 ";" [] [] 2: JS_VARIABLE_STATEMENT@33..57 0: JS_VARIABLE_DECLARATION@33..56 - 0: LET_KW@33..38 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@38..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 "[" [] [] @@ -302,8 +311,9 @@ JsModule { 1: SEMICOLON@56..57 ";" [] [] 3: JS_VARIABLE_STATEMENT@57..85 0: JS_VARIABLE_DECLARATION@57..85 - 0: LET_KW@57..62 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@62..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 "[" [] [] @@ -328,8 +338,9 @@ JsModule { 1: (empty) 4: JS_VARIABLE_STATEMENT@85..109 0: JS_VARIABLE_DECLARATION@85..109 - 0: LET_KW@85..90 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@90..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 "[" [] [] @@ -354,8 +365,9 @@ JsModule { 1: (empty) 5: JS_VARIABLE_STATEMENT@109..138 0: JS_VARIABLE_DECLARATION@109..138 - 0: LET_KW@109..114 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@114..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 "[" [] [] diff --git a/crates/rome_js_parser/test_data/inline/ok/array_binding_rest.rast b/crates/rome_js_parser/test_data/inline/ok/array_binding_rest.rast index 800ff8db264..ff831226cfb 100644 --- a/crates/rome_js_parser/test_data/inline/ok/array_binding_rest.rast +++ b/crates/rome_js_parser/test_data/inline/ok/array_binding_rest.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@0..4 "let" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -35,6 +36,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@20..25 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -76,6 +78,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@43..48 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -124,8 +127,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..68 0: JS_VARIABLE_STATEMENT@0..20 0: JS_VARIABLE_DECLARATION@0..19 - 0: LET_KW@0..4 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@4..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(" ")] @@ -144,8 +148,9 @@ JsModule { 1: SEMICOLON@19..20 ";" [] [] 1: JS_VARIABLE_STATEMENT@20..43 0: JS_VARIABLE_DECLARATION@20..42 - 0: LET_KW@20..25 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@25..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(" ")] @@ -171,8 +176,9 @@ JsModule { 1: SEMICOLON@42..43 ";" [] [] 2: JS_VARIABLE_STATEMENT@43..68 0: JS_VARIABLE_DECLARATION@43..67 - 0: LET_KW@43..48 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@48..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(" ")] diff --git a/crates/rome_js_parser/test_data/inline/ok/async_arrow_expr.rast b/crates/rome_js_parser/test_data/inline/ok/async_arrow_expr.rast index dca04162bcf..8a18e890360 100644 --- a/crates/rome_js_parser/test_data/inline/ok/async_arrow_expr.rast +++ b/crates/rome_js_parser/test_data/inline/ok/async_arrow_expr.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@0..4 "let" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -36,6 +37,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@23..28 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -136,8 +138,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..81 0: JS_VARIABLE_STATEMENT@0..23 0: JS_VARIABLE_DECLARATION@0..23 - 0: LET_KW@0..4 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@4..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(" ")] @@ -159,8 +162,9 @@ JsModule { 1: (empty) 1: JS_VARIABLE_STATEMENT@23..49 0: JS_VARIABLE_DECLARATION@23..49 - 0: LET_KW@23..28 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@28..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(" ")] diff --git a/crates/rome_js_parser/test_data/inline/ok/async_function_expr.rast b/crates/rome_js_parser/test_data/inline/ok/async_function_expr.rast index 07d2a3069f1..72444025c84 100644 --- a/crates/rome_js_parser/test_data/inline/ok/async_function_expr.rast +++ b/crates/rome_js_parser/test_data/inline/ok/async_function_expr.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@0..4 "let" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -40,6 +41,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@28..33 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -86,8 +88,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..61 0: JS_VARIABLE_STATEMENT@0..28 0: JS_VARIABLE_DECLARATION@0..27 - 0: LET_KW@0..4 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@4..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(" ")] @@ -113,8 +116,9 @@ JsModule { 1: SEMICOLON@27..28 ";" [] [] 1: JS_VARIABLE_STATEMENT@28..61 0: JS_VARIABLE_DECLARATION@28..60 - 0: LET_KW@28..33 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@33..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(" ")] diff --git a/crates/rome_js_parser/test_data/inline/ok/async_ident.rast b/crates/rome_js_parser/test_data/inline/ok/async_ident.rast index bd6807561ed..63fee89f456 100644 --- a/crates/rome_js_parser/test_data/inline/ok/async_ident.rast +++ b/crates/rome_js_parser/test_data/inline/ok/async_ident.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@0..4 "let" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -34,8 +35,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..14 0: JS_VARIABLE_STATEMENT@0..14 0: JS_VARIABLE_DECLARATION@0..13 - 0: LET_KW@0..4 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@4..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(" ")] diff --git a/crates/rome_js_parser/test_data/inline/ok/await_in_ambient_context.rast b/crates/rome_js_parser/test_data/inline/ok/await_in_ambient_context.rast index 6cdb60d6c89..34797fc4bca 100644 --- a/crates/rome_js_parser/test_data/inline/ok/await_in_ambient_context.rast +++ b/crates/rome_js_parser/test_data/inline/ok/await_in_ambient_context.rast @@ -6,6 +6,7 @@ JsModule { 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 { @@ -37,8 +38,9 @@ JsModule { 0: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")] 1: JS_VARIABLE_DECLARATION_CLAUSE@8..25 0: JS_VARIABLE_DECLARATION@8..24 - 0: CONST_KW@8..14 "const" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@14..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" [] [] diff --git a/crates/rome_js_parser/test_data/inline/ok/call_arguments.rast b/crates/rome_js_parser/test_data/inline/ok/call_arguments.rast index 95c00b29f9d..af870ce84ec 100644 --- a/crates/rome_js_parser/test_data/inline/ok/call_arguments.rast +++ b/crates/rome_js_parser/test_data/inline/ok/call_arguments.rast @@ -34,6 +34,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@24..29 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -246,8 +247,9 @@ JsModule { 3: R_CURLY@23..24 "}" [] [] 1: JS_VARIABLE_STATEMENT@24..40 0: JS_VARIABLE_DECLARATION@24..39 - 0: LET_KW@24..29 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@29..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" [] [] diff --git a/crates/rome_js_parser/test_data/inline/ok/class_expr.rast b/crates/rome_js_parser/test_data/inline/ok/class_expr.rast index 61b294f0e2d..c4706e0e609 100644 --- a/crates/rome_js_parser/test_data/inline/ok/class_expr.rast +++ b/crates/rome_js_parser/test_data/inline/ok/class_expr.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@0..4 "let" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -32,6 +33,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@17..22 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -112,8 +114,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..71 0: JS_VARIABLE_STATEMENT@0..17 0: JS_VARIABLE_DECLARATION@0..16 - 0: LET_KW@0..4 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@4..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(" ")] @@ -133,8 +136,9 @@ JsModule { 1: SEMICOLON@16..17 ";" [] [] 1: JS_VARIABLE_STATEMENT@17..57 0: JS_VARIABLE_DECLARATION@17..57 - 0: LET_KW@17..22 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@22..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(" ")] diff --git a/crates/rome_js_parser/test_data/inline/ok/decorator.rast b/crates/rome_js_parser/test_data/inline/ok/decorator.rast index 684ea3d1c82..4adf4d8c23b 100644 --- a/crates/rome_js_parser/test_data/inline/ok/decorator.rast +++ b/crates/rome_js_parser/test_data/inline/ok/decorator.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@0..25 "let" [Comments("// class expressions"), Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -41,6 +42,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@49..54 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -107,6 +109,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@104..109 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -774,8 +777,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..818 0: JS_VARIABLE_STATEMENT@0..49 0: JS_VARIABLE_DECLARATION@0..48 - 0: LET_KW@0..25 "let" [Comments("// class expressions"), Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@25..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(" ")] @@ -800,8 +804,9 @@ JsModule { 1: SEMICOLON@48..49 ";" [] [] 1: JS_VARIABLE_STATEMENT@49..104 0: JS_VARIABLE_DECLARATION@49..103 - 0: LET_KW@49..54 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@54..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(" ")] @@ -846,8 +851,9 @@ JsModule { 1: SEMICOLON@103..104 ";" [] [] 2: JS_VARIABLE_STATEMENT@104..140 0: JS_VARIABLE_DECLARATION@104..140 - 0: LET_KW@104..109 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@109..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(" ")] diff --git a/crates/rome_js_parser/test_data/inline/ok/decorator_expression_class.rast b/crates/rome_js_parser/test_data/inline/ok/decorator_expression_class.rast index d13c74bec59..36ab2eab084 100644 --- a/crates/rome_js_parser/test_data/inline/ok/decorator_expression_class.rast +++ b/crates/rome_js_parser/test_data/inline/ok/decorator_expression_class.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@0..4 "let" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -41,6 +42,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@28..33 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -114,8 +116,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..83 0: JS_VARIABLE_STATEMENT@0..28 0: JS_VARIABLE_DECLARATION@0..27 - 0: LET_KW@0..4 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@4..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(" ")] @@ -140,8 +143,9 @@ JsModule { 1: SEMICOLON@27..28 ";" [] [] 1: JS_VARIABLE_STATEMENT@28..83 0: JS_VARIABLE_DECLARATION@28..83 - 0: LET_KW@28..33 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@33..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(" ")] diff --git a/crates/rome_js_parser/test_data/inline/ok/destructuring_initializer_binding.rast b/crates/rome_js_parser/test_data/inline/ok/destructuring_initializer_binding.rast index 250fab111e4..7eb021078c2 100644 --- a/crates/rome_js_parser/test_data/inline/ok/destructuring_initializer_binding.rast +++ b/crates/rome_js_parser/test_data/inline/ok/destructuring_initializer_binding.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: CONST_KW@0..6 "const" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -78,8 +79,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..44 0: JS_VARIABLE_STATEMENT@0..44 0: JS_VARIABLE_DECLARATION@0..44 - 0: CONST_KW@0..6 "const" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@6..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(" ")] diff --git a/crates/rome_js_parser/test_data/inline/ok/directives.rast b/crates/rome_js_parser/test_data/inline/ok/directives.rast index 0d7114b1740..7b88a955ebb 100644 --- a/crates/rome_js_parser/test_data/inline/ok/directives.rast +++ b/crates/rome_js_parser/test_data/inline/ok/directives.rast @@ -9,6 +9,7 @@ JsScript { statements: JsStatementList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@19..24 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -58,6 +59,7 @@ JsScript { statements: JsStatementList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@98..105 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -127,6 +129,7 @@ JsScript { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@227..234 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -161,6 +164,7 @@ JsScript { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@280..285 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -191,6 +195,7 @@ JsScript { statements: JsStatementList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@312..319 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -250,8 +255,9 @@ JsScript { 2: JS_STATEMENT_LIST@19..403 0: JS_VARIABLE_STATEMENT@19..31 0: JS_VARIABLE_DECLARATION@19..30 - 0: LET_KW@19..24 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@24..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(" ")] @@ -286,8 +292,9 @@ JsScript { 2: JS_STATEMENT_LIST@98..147 0: JS_VARIABLE_STATEMENT@98..112 0: JS_VARIABLE_DECLARATION@98..111 - 0: LET_KW@98..105 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@105..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(" ")] @@ -335,8 +342,9 @@ JsScript { 0: SEMICOLON@207..227 ";" [] [Whitespace(" "), Comments("// not a directive")] 2: JS_VARIABLE_STATEMENT@227..241 0: JS_VARIABLE_DECLARATION@227..240 - 0: LET_KW@227..234 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@234..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(" ")] @@ -355,8 +363,9 @@ JsScript { 1: SEMICOLON@279..280 ";" [] [] 4: JS_VARIABLE_STATEMENT@280..364 0: JS_VARIABLE_DECLARATION@280..364 - 0: LET_KW@280..285 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@285..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(" ")] @@ -381,8 +390,9 @@ JsScript { 2: JS_STATEMENT_LIST@312..362 0: JS_VARIABLE_STATEMENT@312..326 0: JS_VARIABLE_DECLARATION@312..325 - 0: LET_KW@312..319 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@319..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(" ")] diff --git a/crates/rome_js_parser/test_data/inline/ok/do_while_statement.rast b/crates/rome_js_parser/test_data/inline/ok/do_while_statement.rast index 6a1dc773ba0..5522fc60c0a 100644 --- a/crates/rome_js_parser/test_data/inline/ok/do_while_statement.rast +++ b/crates/rome_js_parser/test_data/inline/ok/do_while_statement.rast @@ -84,6 +84,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@78..83 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -230,8 +231,9 @@ JsModule { 6: SEMICOLON@77..78 ";" [] [] 2: JS_VARIABLE_STATEMENT@78..89 0: JS_VARIABLE_DECLARATION@78..88 - 0: LET_KW@78..83 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@83..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(" ")] diff --git a/crates/rome_js_parser/test_data/inline/ok/export_variable_clause.rast b/crates/rome_js_parser/test_data/inline/ok/export_variable_clause.rast index 8cd7eccf677..a928c16fac8 100644 --- a/crates/rome_js_parser/test_data/inline/ok/export_variable_clause.rast +++ b/crates/rome_js_parser/test_data/inline/ok/export_variable_clause.rast @@ -7,6 +7,7 @@ JsModule { 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 { @@ -26,6 +27,7 @@ JsModule { 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 { @@ -50,6 +52,7 @@ JsModule { 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 { @@ -98,8 +101,9 @@ JsModule { 1: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] 2: JS_VARIABLE_DECLARATION_CLAUSE@7..13 0: JS_VARIABLE_DECLARATION@7..12 - 0: LET_KW@7..11 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@11..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" [] [] @@ -111,8 +115,9 @@ JsModule { 1: EXPORT_KW@13..21 "export" [Newline("\n")] [Whitespace(" ")] 2: JS_VARIABLE_DECLARATION_CLAUSE@21..33 0: JS_VARIABLE_DECLARATION@21..32 - 0: CONST_KW@21..27 "const" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@27..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(" ")] @@ -127,8 +132,9 @@ JsModule { 1: EXPORT_KW@33..41 "export" [Newline("\n")] [Whitespace(" ")] 2: JS_VARIABLE_DECLARATION_CLAUSE@41..57 0: JS_VARIABLE_DECLARATION@41..56 - 0: VAR_KW@41..45 "var" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@45..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" [] [] diff --git a/crates/rome_js_parser/test_data/inline/ok/for_await_async_identifier.rast b/crates/rome_js_parser/test_data/inline/ok/for_await_async_identifier.rast index 34914afe74b..dcd1334e698 100644 --- a/crates/rome_js_parser/test_data/inline/ok/for_await_async_identifier.rast +++ b/crates/rome_js_parser/test_data/inline/ok/for_await_async_identifier.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@0..4 "let" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -71,8 +72,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..62 0: JS_VARIABLE_STATEMENT@0..10 0: JS_VARIABLE_DECLARATION@0..9 - 0: LET_KW@0..4 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@4..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" [] [] diff --git a/crates/rome_js_parser/test_data/inline/ok/for_in_initializer_loose_mode.rast b/crates/rome_js_parser/test_data/inline/ok/for_in_initializer_loose_mode.rast index 4642185657c..a5ebd71cf5b 100644 --- a/crates/rome_js_parser/test_data/inline/ok/for_in_initializer_loose_mode.rast +++ b/crates/rome_js_parser/test_data/inline/ok/for_in_initializer_loose_mode.rast @@ -6,6 +6,7 @@ JsScript { 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 { @@ -45,8 +46,9 @@ JsScript { 0: FOR_KW@0..14 "for" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")] 1: L_PAREN@14..15 "(" [] [] 2: JS_FOR_VARIABLE_DECLARATION@15..25 - 0: VAR_KW@15..19 "var" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR@19..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) diff --git a/crates/rome_js_parser/test_data/inline/ok/for_stmt.rast b/crates/rome_js_parser/test_data/inline/ok/for_stmt.rast index b4c6be9be8f..cb44b45d253 100644 --- a/crates/rome_js_parser/test_data/inline/ok/for_stmt.rast +++ b/crates/rome_js_parser/test_data/inline/ok/for_stmt.rast @@ -6,6 +6,7 @@ JsModule { 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 { @@ -53,6 +54,7 @@ JsModule { 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 { @@ -130,6 +132,7 @@ JsModule { 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 { @@ -156,6 +159,7 @@ JsModule { 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 { @@ -218,6 +222,7 @@ JsModule { 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 { @@ -252,8 +257,9 @@ JsModule { 0: FOR_KW@0..4 "for" [] [Whitespace(" ")] 1: L_PAREN@4..5 "(" [] [] 2: JS_VARIABLE_DECLARATION@5..14 - 0: LET_KW@5..9 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@9..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(" ")] @@ -285,8 +291,9 @@ JsModule { 1: (empty) 2: L_PAREN@36..37 "(" [] [] 3: JS_FOR_VARIABLE_DECLARATION@37..54 - 0: LET_KW@37..41 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR@41..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 @@ -345,8 +352,9 @@ JsModule { 1: (empty) 2: L_PAREN@99..100 "(" [] [] 3: JS_FOR_VARIABLE_DECLARATION@100..108 - 0: LET_KW@100..104 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR@104..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) @@ -365,8 +373,9 @@ JsModule { 0: FOR_KW@117..122 "for" [Newline("\n")] [Whitespace(" ")] 1: L_PAREN@122..123 "(" [] [] 2: JS_VARIABLE_DECLARATION@123..139 - 0: LET_KW@123..127 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@127..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(" ")] @@ -408,8 +417,9 @@ JsModule { 1: AWAIT_KW@160..166 "await" [] [Whitespace(" ")] 2: L_PAREN@166..167 "(" [] [] 3: JS_FOR_VARIABLE_DECLARATION@167..173 - 0: LET_KW@167..171 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR@171..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) diff --git a/crates/rome_js_parser/test_data/inline/ok/function_expr.rast b/crates/rome_js_parser/test_data/inline/ok/function_expr.rast index 4e98fcb6d9e..d54894a1bd9 100644 --- a/crates/rome_js_parser/test_data/inline/ok/function_expr.rast +++ b/crates/rome_js_parser/test_data/inline/ok/function_expr.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@0..4 "let" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -40,6 +41,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@21..26 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -86,8 +88,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..47 0: JS_VARIABLE_STATEMENT@0..21 0: JS_VARIABLE_DECLARATION@0..21 - 0: LET_KW@0..4 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@4..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(" ")] @@ -113,8 +116,9 @@ JsModule { 1: (empty) 1: JS_VARIABLE_STATEMENT@21..47 0: JS_VARIABLE_DECLARATION@21..47 - 0: LET_KW@21..26 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@26..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(" ")] diff --git a/crates/rome_js_parser/test_data/inline/ok/getter_object_member.rast b/crates/rome_js_parser/test_data/inline/ok/getter_object_member.rast index b2703395c4f..c8d39b1873b 100644 --- a/crates/rome_js_parser/test_data/inline/ok/getter_object_member.rast +++ b/crates/rome_js_parser/test_data/inline/ok/getter_object_member.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@0..4 "let" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -177,8 +178,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..225 0: JS_VARIABLE_STATEMENT@0..225 0: JS_VARIABLE_DECLARATION@0..225 - 0: LET_KW@0..4 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@4..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(" ")] diff --git a/crates/rome_js_parser/test_data/inline/ok/hoisted_declaration_in_single_statement_context.rast b/crates/rome_js_parser/test_data/inline/ok/hoisted_declaration_in_single_statement_context.rast index 21a41efc679..5ac2e7b8cb4 100644 --- a/crates/rome_js_parser/test_data/inline/ok/hoisted_declaration_in_single_statement_context.rast +++ b/crates/rome_js_parser/test_data/inline/ok/hoisted_declaration_in_single_statement_context.rast @@ -11,6 +11,7 @@ JsModule { 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 { @@ -42,8 +43,9 @@ JsModule { 3: R_PAREN@8..10 ")" [] [Whitespace(" ")] 4: JS_VARIABLE_STATEMENT@10..16 0: JS_VARIABLE_DECLARATION@10..15 - 0: VAR_KW@10..14 "var" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@14..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" [] [] diff --git a/crates/rome_js_parser/test_data/inline/ok/identifier.rast b/crates/rome_js_parser/test_data/inline/ok/identifier.rast index d606e306005..1018ef0991b 100644 --- a/crates/rome_js_parser/test_data/inline/ok/identifier.rast +++ b/crates/rome_js_parser/test_data/inline/ok/identifier.rast @@ -12,6 +12,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@4..9 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -45,8 +46,9 @@ JsModule { 1: SEMICOLON@3..4 ";" [] [] 1: JS_VARIABLE_STATEMENT@4..22 0: JS_VARIABLE_DECLARATION@4..21 - 0: LET_KW@4..9 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@9..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(" ")] diff --git a/crates/rome_js_parser/test_data/inline/ok/issue_2790.rast b/crates/rome_js_parser/test_data/inline/ok/issue_2790.rast index cc5907f1f22..9ce3d389d32 100644 --- a/crates/rome_js_parser/test_data/inline/ok/issue_2790.rast +++ b/crates/rome_js_parser/test_data/inline/ok/issue_2790.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: VAR_KW@0..4 "var" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -64,8 +65,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..44 0: JS_VARIABLE_STATEMENT@0..44 0: JS_VARIABLE_DECLARATION@0..43 - 0: VAR_KW@0..4 "var" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@4..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" [] [] diff --git a/crates/rome_js_parser/test_data/inline/ok/jsx_children_expression.rast b/crates/rome_js_parser/test_data/inline/ok/jsx_children_expression.rast index 6afca686259..51b1de1ee8d 100644 --- a/crates/rome_js_parser/test_data/inline/ok/jsx_children_expression.rast +++ b/crates/rome_js_parser/test_data/inline/ok/jsx_children_expression.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@0..4 "let" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -19,6 +20,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@6..11 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -34,6 +36,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@13..18 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -49,6 +52,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@20..25 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -64,6 +68,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@29..34 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -885,8 +890,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..616 0: JS_VARIABLE_STATEMENT@0..6 0: JS_VARIABLE_DECLARATION@0..5 - 0: LET_KW@0..4 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@4..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" [] [] @@ -895,8 +901,9 @@ JsModule { 1: SEMICOLON@5..6 ";" [] [] 1: JS_VARIABLE_STATEMENT@6..13 0: JS_VARIABLE_DECLARATION@6..12 - 0: LET_KW@6..11 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@11..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" [] [] @@ -905,8 +912,9 @@ JsModule { 1: SEMICOLON@12..13 ";" [] [] 2: JS_VARIABLE_STATEMENT@13..20 0: JS_VARIABLE_DECLARATION@13..19 - 0: LET_KW@13..18 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@18..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" [] [] @@ -915,8 +923,9 @@ JsModule { 1: SEMICOLON@19..20 ";" [] [] 3: JS_VARIABLE_STATEMENT@20..29 0: JS_VARIABLE_DECLARATION@20..28 - 0: LET_KW@20..25 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@25..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" [] [] @@ -925,8 +934,9 @@ JsModule { 1: SEMICOLON@28..29 ";" [] [] 4: JS_VARIABLE_STATEMENT@29..47 0: JS_VARIABLE_DECLARATION@29..46 - 0: LET_KW@29..34 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@34..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(" ")] diff --git a/crates/rome_js_parser/test_data/inline/ok/jsx_element_on_arrow_function.rast b/crates/rome_js_parser/test_data/inline/ok/jsx_element_on_arrow_function.rast index 2517b318557..5a3b4248975 100644 --- a/crates/rome_js_parser/test_data/inline/ok/jsx_element_on_arrow_function.rast +++ b/crates/rome_js_parser/test_data/inline/ok/jsx_element_on_arrow_function.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: CONST_KW@0..6 "const" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -54,6 +55,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: CONST_KW@28..35 "const" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -116,8 +118,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..59 0: JS_VARIABLE_STATEMENT@0..28 0: JS_VARIABLE_DECLARATION@0..27 - 0: CONST_KW@0..6 "const" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@6..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(" ")] @@ -152,8 +155,9 @@ JsModule { 1: SEMICOLON@27..28 ";" [] [] 1: JS_VARIABLE_STATEMENT@28..59 0: JS_VARIABLE_DECLARATION@28..58 - 0: CONST_KW@28..35 "const" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@35..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(" ")] diff --git a/crates/rome_js_parser/test_data/inline/ok/jsx_primary_expression.rast b/crates/rome_js_parser/test_data/inline/ok/jsx_primary_expression.rast index 07b1620b710..cf0c2480ff6 100644 --- a/crates/rome_js_parser/test_data/inline/ok/jsx_primary_expression.rast +++ b/crates/rome_js_parser/test_data/inline/ok/jsx_primary_expression.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@0..4 "let" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -61,8 +62,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..28 0: JS_VARIABLE_STATEMENT@0..28 0: JS_VARIABLE_DECLARATION@0..27 - 0: LET_KW@0..4 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@4..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(" ")] diff --git a/crates/rome_js_parser/test_data/inline/ok/jsx_spread_attribute.rast b/crates/rome_js_parser/test_data/inline/ok/jsx_spread_attribute.rast index 08dae34d9b3..88a6758b3c7 100644 --- a/crates/rome_js_parser/test_data/inline/ok/jsx_spread_attribute.rast +++ b/crates/rome_js_parser/test_data/inline/ok/jsx_spread_attribute.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@0..4 "let" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -60,8 +61,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..29 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: (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(" ")] diff --git a/crates/rome_js_parser/test_data/inline/ok/labelled_statement_in_single_statement_context.rast b/crates/rome_js_parser/test_data/inline/ok/labelled_statement_in_single_statement_context.rast index 373811a1410..13b25ec7d29 100644 --- a/crates/rome_js_parser/test_data/inline/ok/labelled_statement_in_single_statement_context.rast +++ b/crates/rome_js_parser/test_data/inline/ok/labelled_statement_in_single_statement_context.rast @@ -14,6 +14,7 @@ JsModule { colon_token: COLON@16..18 ":" [] [Whitespace(" ")], body: JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: VAR_KW@18..22 "var" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -54,8 +55,9 @@ JsModule { 1: COLON@16..18 ":" [] [Whitespace(" ")] 2: JS_VARIABLE_STATEMENT@18..29 0: JS_VARIABLE_DECLARATION@18..28 - 0: VAR_KW@18..22 "var" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@22..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(" ")] diff --git a/crates/rome_js_parser/test_data/inline/ok/let_asi_rule.rast b/crates/rome_js_parser/test_data/inline/ok/let_asi_rule.rast index 06584937b26..c070970be54 100644 --- a/crates/rome_js_parser/test_data/inline/ok/let_asi_rule.rast +++ b/crates/rome_js_parser/test_data/inline/ok/let_asi_rule.rast @@ -4,6 +4,7 @@ JsScript { 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 { @@ -27,6 +28,7 @@ JsScript { 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 { @@ -74,8 +76,9 @@ JsScript { 2: JS_STATEMENT_LIST@0..72 0: JS_VARIABLE_STATEMENT@0..30 0: JS_VARIABLE_DECLARATION@0..29 - 0: LET_KW@0..23 "let" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" "), Comments("// NO ASI")] - 1: JS_VARIABLE_DECLARATOR_LIST@23..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(" ")] @@ -90,8 +93,9 @@ JsScript { 1: AWAIT_KW@35..41 "await" [] [Whitespace(" ")] 2: L_PAREN@41..42 "(" [] [] 3: JS_FOR_VARIABLE_DECLARATION@42..48 - 0: VAR_KW@42..46 "var" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR@46..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) diff --git a/crates/rome_js_parser/test_data/inline/ok/object_expr.rast b/crates/rome_js_parser/test_data/inline/ok/object_expr.rast index a1ff0c97118..d3b47ca7083 100644 --- a/crates/rome_js_parser/test_data/inline/ok/object_expr.rast +++ b/crates/rome_js_parser/test_data/inline/ok/object_expr.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@0..4 "let" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -26,6 +27,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@11..16 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -63,8 +65,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..26 0: JS_VARIABLE_STATEMENT@0..11 0: JS_VARIABLE_DECLARATION@0..10 - 0: LET_KW@0..4 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@4..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(" ")] @@ -78,8 +81,9 @@ JsModule { 1: SEMICOLON@10..11 ";" [] [] 1: JS_VARIABLE_STATEMENT@11..26 0: JS_VARIABLE_DECLARATION@11..26 - 0: LET_KW@11..16 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@16..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(" ")] diff --git a/crates/rome_js_parser/test_data/inline/ok/object_expr_async_method.rast b/crates/rome_js_parser/test_data/inline/ok/object_expr_async_method.rast index 1ae7b4adcdd..67096168d75 100644 --- a/crates/rome_js_parser/test_data/inline/ok/object_expr_async_method.rast +++ b/crates/rome_js_parser/test_data/inline/ok/object_expr_async_method.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@0..4 "let" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -76,8 +77,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..47 0: JS_VARIABLE_STATEMENT@0..47 0: JS_VARIABLE_DECLARATION@0..47 - 0: LET_KW@0..4 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@4..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(" ")] diff --git a/crates/rome_js_parser/test_data/inline/ok/object_expr_generator_method.rast b/crates/rome_js_parser/test_data/inline/ok/object_expr_generator_method.rast index ba54cc8e367..4b6961adaab 100644 --- a/crates/rome_js_parser/test_data/inline/ok/object_expr_generator_method.rast +++ b/crates/rome_js_parser/test_data/inline/ok/object_expr_generator_method.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@0..4 "let" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -55,8 +56,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..21 0: JS_VARIABLE_STATEMENT@0..21 0: JS_VARIABLE_DECLARATION@0..21 - 0: LET_KW@0..4 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@4..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(" ")] diff --git a/crates/rome_js_parser/test_data/inline/ok/object_expr_ident_literal_prop.rast b/crates/rome_js_parser/test_data/inline/ok/object_expr_ident_literal_prop.rast index 3ef1b841f0d..6946aa0a444 100644 --- a/crates/rome_js_parser/test_data/inline/ok/object_expr_ident_literal_prop.rast +++ b/crates/rome_js_parser/test_data/inline/ok/object_expr_ident_literal_prop.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@0..4 "let" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -44,8 +45,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..19 0: JS_VARIABLE_STATEMENT@0..19 0: JS_VARIABLE_DECLARATION@0..19 - 0: LET_KW@0..4 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@4..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(" ")] diff --git a/crates/rome_js_parser/test_data/inline/ok/object_expr_method.rast b/crates/rome_js_parser/test_data/inline/ok/object_expr_method.rast index a9e52e9fd08..543a12c2d9f 100644 --- a/crates/rome_js_parser/test_data/inline/ok/object_expr_method.rast +++ b/crates/rome_js_parser/test_data/inline/ok/object_expr_method.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@0..4 "let" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -177,8 +178,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..85 0: JS_VARIABLE_STATEMENT@0..85 0: JS_VARIABLE_DECLARATION@0..85 - 0: LET_KW@0..4 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@4..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(" ")] diff --git a/crates/rome_js_parser/test_data/inline/ok/object_expr_spread_prop.rast b/crates/rome_js_parser/test_data/inline/ok/object_expr_spread_prop.rast index ba282e1336a..dec97e80534 100644 --- a/crates/rome_js_parser/test_data/inline/ok/object_expr_spread_prop.rast +++ b/crates/rome_js_parser/test_data/inline/ok/object_expr_spread_prop.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@0..4 "let" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -43,8 +44,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..16 0: JS_VARIABLE_STATEMENT@0..16 0: JS_VARIABLE_DECLARATION@0..16 - 0: LET_KW@0..4 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@4..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(" ")] diff --git a/crates/rome_js_parser/test_data/inline/ok/object_member_name.rast b/crates/rome_js_parser/test_data/inline/ok/object_member_name.rast index 661e5f53d38..78beb78e2bd 100644 --- a/crates/rome_js_parser/test_data/inline/ok/object_member_name.rast +++ b/crates/rome_js_parser/test_data/inline/ok/object_member_name.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@0..4 "let" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -92,8 +93,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..52 0: JS_VARIABLE_STATEMENT@0..52 0: JS_VARIABLE_DECLARATION@0..52 - 0: LET_KW@0..4 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@4..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(" ")] diff --git a/crates/rome_js_parser/test_data/inline/ok/object_prop_name.rast b/crates/rome_js_parser/test_data/inline/ok/object_prop_name.rast index 661e5f53d38..78beb78e2bd 100644 --- a/crates/rome_js_parser/test_data/inline/ok/object_prop_name.rast +++ b/crates/rome_js_parser/test_data/inline/ok/object_prop_name.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@0..4 "let" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -92,8 +93,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..52 0: JS_VARIABLE_STATEMENT@0..52 0: JS_VARIABLE_DECLARATION@0..52 - 0: LET_KW@0..4 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@4..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(" ")] diff --git a/crates/rome_js_parser/test_data/inline/ok/object_property_binding.rast b/crates/rome_js_parser/test_data/inline/ok/object_property_binding.rast index fd94ba1b961..7c1ad3b7c8a 100644 --- a/crates/rome_js_parser/test_data/inline/ok/object_property_binding.rast +++ b/crates/rome_js_parser/test_data/inline/ok/object_property_binding.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@0..4 "let" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -39,6 +40,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@22..27 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -89,8 +91,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..54 0: JS_VARIABLE_STATEMENT@0..22 0: JS_VARIABLE_DECLARATION@0..22 - 0: LET_KW@0..4 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@4..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(" ")] @@ -113,8 +116,9 @@ JsModule { 1: (empty) 1: JS_VARIABLE_STATEMENT@22..54 0: JS_VARIABLE_DECLARATION@22..54 - 0: LET_KW@22..27 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@27..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(" ")] diff --git a/crates/rome_js_parser/test_data/inline/ok/object_shorthand_property.rast b/crates/rome_js_parser/test_data/inline/ok/object_shorthand_property.rast index b82e5a56012..f38215c4f8c 100644 --- a/crates/rome_js_parser/test_data/inline/ok/object_shorthand_property.rast +++ b/crates/rome_js_parser/test_data/inline/ok/object_shorthand_property.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@0..4 "let" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -42,6 +43,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@16..21 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -109,8 +111,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..54 0: JS_VARIABLE_STATEMENT@0..16 0: JS_VARIABLE_DECLARATION@0..16 - 0: LET_KW@0..4 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@4..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(" ")] @@ -134,8 +137,9 @@ JsModule { 1: (empty) 1: JS_VARIABLE_STATEMENT@16..54 0: JS_VARIABLE_DECLARATION@16..54 - 0: LET_KW@16..21 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@21..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(" ")] diff --git a/crates/rome_js_parser/test_data/inline/ok/rest_property_binding.rast b/crates/rome_js_parser/test_data/inline/ok/rest_property_binding.rast index b17235b8601..3b0863044b1 100644 --- a/crates/rome_js_parser/test_data/inline/ok/rest_property_binding.rast +++ b/crates/rome_js_parser/test_data/inline/ok/rest_property_binding.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@0..4 "let" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -35,6 +36,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@20..25 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -87,8 +89,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..45 0: JS_VARIABLE_STATEMENT@0..20 0: JS_VARIABLE_DECLARATION@0..19 - 0: LET_KW@0..4 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@4..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(" ")] @@ -107,8 +110,9 @@ JsModule { 1: SEMICOLON@19..20 ";" [] [] 1: JS_VARIABLE_STATEMENT@20..45 0: JS_VARIABLE_DECLARATION@20..44 - 0: LET_KW@20..25 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@25..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(" ")] diff --git a/crates/rome_js_parser/test_data/inline/ok/scoped_declarations.rast b/crates/rome_js_parser/test_data/inline/ok/scoped_declarations.rast index 919e162300a..5c055655789 100644 --- a/crates/rome_js_parser/test_data/inline/ok/scoped_declarations.rast +++ b/crates/rome_js_parser/test_data/inline/ok/scoped_declarations.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@0..4 "let" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -35,6 +36,7 @@ JsModule { statements: JsStatementList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@20..29 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -76,8 +78,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..48 0: JS_VARIABLE_STATEMENT@0..48 0: JS_VARIABLE_DECLARATION@0..47 - 0: LET_KW@0..4 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@4..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(" ")] @@ -104,8 +107,9 @@ JsModule { 2: JS_STATEMENT_LIST@20..41 0: JS_VARIABLE_STATEMENT@20..41 0: JS_VARIABLE_DECLARATION@20..40 - 0: LET_KW@20..29 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@29..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(" ")] diff --git a/crates/rome_js_parser/test_data/inline/ok/semicolons.rast b/crates/rome_js_parser/test_data/inline/ok/semicolons.rast index f258c0817d4..db7b21d91b8 100644 --- a/crates/rome_js_parser/test_data/inline/ok/semicolons.rast +++ b/crates/rome_js_parser/test_data/inline/ok/semicolons.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@0..4 "let" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -26,6 +27,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@14..19 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -48,6 +50,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@28..33 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -63,6 +66,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@38..43 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -78,6 +82,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@47..52 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -130,8 +135,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..88 0: JS_VARIABLE_STATEMENT@0..14 0: JS_VARIABLE_DECLARATION@0..13 - 0: LET_KW@0..4 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@4..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(" ")] @@ -144,8 +150,9 @@ JsModule { 1: SEMICOLON@13..14 ";" [] [] 1: JS_VARIABLE_STATEMENT@14..28 0: JS_VARIABLE_DECLARATION@14..27 - 0: LET_KW@14..19 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@19..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(" ")] @@ -158,8 +165,9 @@ JsModule { 1: SEMICOLON@27..28 ";" [] [] 2: JS_VARIABLE_STATEMENT@28..38 0: JS_VARIABLE_DECLARATION@28..37 - 0: LET_KW@28..33 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@33..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" [] [] @@ -168,8 +176,9 @@ JsModule { 1: SEMICOLON@37..38 ";" [] [] 3: JS_VARIABLE_STATEMENT@38..47 0: JS_VARIABLE_DECLARATION@38..47 - 0: LET_KW@38..43 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@43..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" [] [] @@ -178,8 +187,9 @@ JsModule { 1: (empty) 4: JS_VARIABLE_STATEMENT@47..56 0: JS_VARIABLE_DECLARATION@47..56 - 0: LET_KW@47..52 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@52..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" [] [] diff --git a/crates/rome_js_parser/test_data/inline/ok/setter_object_member.rast b/crates/rome_js_parser/test_data/inline/ok/setter_object_member.rast index ee59c7205d0..5d69f280b12 100644 --- a/crates/rome_js_parser/test_data/inline/ok/setter_object_member.rast +++ b/crates/rome_js_parser/test_data/inline/ok/setter_object_member.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@0..4 "let" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -169,8 +170,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..165 0: JS_VARIABLE_STATEMENT@0..165 0: JS_VARIABLE_DECLARATION@0..165 - 0: LET_KW@0..4 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@4..165 + 0: (empty) + 1: LET_KW@0..4 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@4..165 0: JS_VARIABLE_DECLARATOR@4..165 0: JS_IDENTIFIER_BINDING@4..6 0: IDENT@4..6 "a" [] [Whitespace(" ")] diff --git a/crates/rome_js_parser/test_data/inline/ok/single_parameter_arrow_function_with_parameter_named_async.rast b/crates/rome_js_parser/test_data/inline/ok/single_parameter_arrow_function_with_parameter_named_async.rast index 2fb34d571bd..8e2e160acef 100644 --- a/crates/rome_js_parser/test_data/inline/ok/single_parameter_arrow_function_with_parameter_named_async.rast +++ b/crates/rome_js_parser/test_data/inline/ok/single_parameter_arrow_function_with_parameter_named_async.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@0..4 "let" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -43,8 +44,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..24 0: JS_VARIABLE_STATEMENT@0..24 0: JS_VARIABLE_DECLARATION@0..23 - 0: LET_KW@0..4 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@4..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(" ")] diff --git a/crates/rome_js_parser/test_data/inline/ok/template_literal.rast b/crates/rome_js_parser/test_data/inline/ok/template_literal.rast index b304bbf754b..fd1ddf169ec 100644 --- a/crates/rome_js_parser/test_data/inline/ok/template_literal.rast +++ b/crates/rome_js_parser/test_data/inline/ok/template_literal.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@0..4 "let" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -41,6 +42,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@21..26 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -65,6 +67,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@33..38 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -99,6 +102,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@51..56 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -127,6 +131,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@66..71 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -179,8 +184,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..96 0: JS_VARIABLE_STATEMENT@0..21 0: JS_VARIABLE_DECLARATION@0..20 - 0: LET_KW@0..4 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@4..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(" ")] @@ -204,8 +210,9 @@ JsModule { 1: SEMICOLON@20..21 ";" [] [] 1: JS_VARIABLE_STATEMENT@21..33 0: JS_VARIABLE_DECLARATION@21..32 - 0: LET_KW@21..26 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@26..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(" ")] @@ -221,8 +228,9 @@ JsModule { 1: SEMICOLON@32..33 ";" [] [] 2: JS_VARIABLE_STATEMENT@33..51 0: JS_VARIABLE_DECLARATION@33..50 - 0: LET_KW@33..38 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@38..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(" ")] @@ -244,8 +252,9 @@ JsModule { 1: SEMICOLON@50..51 ";" [] [] 3: JS_VARIABLE_STATEMENT@51..66 0: JS_VARIABLE_DECLARATION@51..65 - 0: LET_KW@51..56 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@56..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(" ")] @@ -263,8 +272,9 @@ JsModule { 1: SEMICOLON@65..66 ";" [] [] 4: JS_VARIABLE_STATEMENT@66..96 0: JS_VARIABLE_DECLARATION@66..95 - 0: LET_KW@66..71 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@71..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(" ")] diff --git a/crates/rome_js_parser/test_data/inline/ok/ts_ambient_const_variable_statement.rast b/crates/rome_js_parser/test_data/inline/ok/ts_ambient_const_variable_statement.rast index bd40eca4b19..7af5dc13918 100644 --- a/crates/rome_js_parser/test_data/inline/ok/ts_ambient_const_variable_statement.rast +++ b/crates/rome_js_parser/test_data/inline/ok/ts_ambient_const_variable_statement.rast @@ -6,6 +6,7 @@ JsModule { 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 { @@ -61,8 +62,9 @@ JsModule { 0: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")] 1: JS_VARIABLE_DECLARATION_CLAUSE@8..34 0: JS_VARIABLE_DECLARATION@8..33 - 0: CONST_KW@8..14 "const" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@14..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" [] [] diff --git a/crates/rome_js_parser/test_data/inline/ok/ts_ambient_let_variable_statement.rast b/crates/rome_js_parser/test_data/inline/ok/ts_ambient_let_variable_statement.rast index 9357de27345..af718e245ac 100644 --- a/crates/rome_js_parser/test_data/inline/ok/ts_ambient_let_variable_statement.rast +++ b/crates/rome_js_parser/test_data/inline/ok/ts_ambient_let_variable_statement.rast @@ -6,6 +6,7 @@ JsModule { 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 { @@ -56,8 +57,9 @@ JsModule { 0: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")] 1: JS_VARIABLE_DECLARATION_CLAUSE@8..23 0: JS_VARIABLE_DECLARATION@8..22 - 0: LET_KW@8..12 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@12..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" [] [] diff --git a/crates/rome_js_parser/test_data/inline/ok/ts_ambient_var_statement.rast b/crates/rome_js_parser/test_data/inline/ok/ts_ambient_var_statement.rast index 299faf021cd..346671a197f 100644 --- a/crates/rome_js_parser/test_data/inline/ok/ts_ambient_var_statement.rast +++ b/crates/rome_js_parser/test_data/inline/ok/ts_ambient_var_statement.rast @@ -6,6 +6,7 @@ JsModule { 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 { @@ -48,8 +49,9 @@ JsModule { 0: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")] 1: JS_VARIABLE_DECLARATION_CLAUSE@8..20 0: JS_VARIABLE_DECLARATION@8..19 - 0: VAR_KW@8..12 "var" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@12..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" [] [] diff --git a/crates/rome_js_parser/test_data/inline/ok/ts_arrow_function_type_parameters.rast b/crates/rome_js_parser/test_data/inline/ok/ts_arrow_function_type_parameters.rast index 7c2780ab9f6..426e3ebc37a 100644 --- a/crates/rome_js_parser/test_data/inline/ok/ts_arrow_function_type_parameters.rast +++ b/crates/rome_js_parser/test_data/inline/ok/ts_arrow_function_type_parameters.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@0..4 "let" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -133,6 +134,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@66..71 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -246,8 +248,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..128 0: JS_VARIABLE_STATEMENT@0..66 0: JS_VARIABLE_DECLARATION@0..65 - 0: LET_KW@0..4 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@4..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(" ")] @@ -337,8 +340,9 @@ JsModule { 1: SEMICOLON@65..66 ";" [] [] 1: JS_VARIABLE_STATEMENT@66..128 0: JS_VARIABLE_DECLARATION@66..127 - 0: LET_KW@66..71 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@71..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(" ")] diff --git a/crates/rome_js_parser/test_data/inline/ok/ts_as_assignment.rast b/crates/rome_js_parser/test_data/inline/ok/ts_as_assignment.rast index 9549601ddc6..5d3d123e0de 100644 --- a/crates/rome_js_parser/test_data/inline/ok/ts_as_assignment.rast +++ b/crates/rome_js_parser/test_data/inline/ok/ts_as_assignment.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@0..4 "let" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -305,8 +306,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..239 0: JS_VARIABLE_STATEMENT@0..11 0: JS_VARIABLE_DECLARATION@0..10 - 0: LET_KW@0..4 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@4..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" [] [] diff --git a/crates/rome_js_parser/test_data/inline/ok/ts_as_expression.rast b/crates/rome_js_parser/test_data/inline/ok/ts_as_expression.rast index 05344905163..dac39d9e7e0 100644 --- a/crates/rome_js_parser/test_data/inline/ok/ts_as_expression.rast +++ b/crates/rome_js_parser/test_data/inline/ok/ts_as_expression.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@0..4 "let" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -29,6 +30,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@22..27 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -57,6 +59,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@43..48 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -88,6 +91,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@63..68 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -118,6 +122,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@96..101 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -173,8 +178,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..155 0: JS_VARIABLE_STATEMENT@0..22 0: JS_VARIABLE_DECLARATION@0..21 - 0: LET_KW@0..4 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@4..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" [] [] @@ -189,8 +195,9 @@ JsModule { 1: SEMICOLON@21..22 ";" [] [] 1: JS_VARIABLE_STATEMENT@22..43 0: JS_VARIABLE_DECLARATION@22..42 - 0: LET_KW@22..27 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@27..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(" ")] @@ -207,8 +214,9 @@ JsModule { 1: SEMICOLON@42..43 ";" [] [] 2: JS_VARIABLE_STATEMENT@43..63 0: JS_VARIABLE_DECLARATION@43..62 - 0: LET_KW@43..48 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@48..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(" ")] @@ -227,8 +235,9 @@ JsModule { 1: SEMICOLON@62..63 ";" [] [] 3: JS_VARIABLE_STATEMENT@63..92 0: JS_VARIABLE_DECLARATION@63..92 - 0: LET_KW@63..68 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@68..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(" ")] @@ -246,8 +255,9 @@ JsModule { 1: SEMICOLON@95..96 ";" [] [] 5: JS_VARIABLE_STATEMENT@96..155 0: JS_VARIABLE_DECLARATION@96..154 - 0: LET_KW@96..101 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@101..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(" ")] diff --git a/crates/rome_js_parser/test_data/inline/ok/ts_declare_const_initializer.rast b/crates/rome_js_parser/test_data/inline/ok/ts_declare_const_initializer.rast index f6a5566edbb..3c638e7d882 100644 --- a/crates/rome_js_parser/test_data/inline/ok/ts_declare_const_initializer.rast +++ b/crates/rome_js_parser/test_data/inline/ok/ts_declare_const_initializer.rast @@ -14,6 +14,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: CONST_KW@22..28 "const" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -51,8 +52,9 @@ JsModule { 1: JS_MODULE_ITEM_LIST@22..31 0: JS_VARIABLE_STATEMENT@22..31 0: JS_VARIABLE_DECLARATION@22..29 - 0: CONST_KW@22..28 "const" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@28..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" [] [] diff --git a/crates/rome_js_parser/test_data/inline/ok/ts_export_assignment_identifier.rast b/crates/rome_js_parser/test_data/inline/ok/ts_export_assignment_identifier.rast index 0cc8b3e9887..60317ead5a9 100644 --- a/crates/rome_js_parser/test_data/inline/ok/ts_export_assignment_identifier.rast +++ b/crates/rome_js_parser/test_data/inline/ok/ts_export_assignment_identifier.rast @@ -6,6 +6,7 @@ JsModule { 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 { @@ -138,8 +139,9 @@ JsModule { 0: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")] 1: JS_VARIABLE_DECLARATION_CLAUSE@8..30 0: JS_VARIABLE_DECLARATION@8..30 - 0: CONST_KW@8..14 "const" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@14..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" [] [] diff --git a/crates/rome_js_parser/test_data/inline/ok/ts_export_assignment_qualified_name.rast b/crates/rome_js_parser/test_data/inline/ok/ts_export_assignment_qualified_name.rast index 9492c676aeb..1cd5f01cca8 100644 --- a/crates/rome_js_parser/test_data/inline/ok/ts_export_assignment_qualified_name.rast +++ b/crates/rome_js_parser/test_data/inline/ok/ts_export_assignment_qualified_name.rast @@ -6,6 +6,7 @@ JsModule { 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 { @@ -73,8 +74,9 @@ JsModule { 0: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")] 1: JS_VARIABLE_DECLARATION_CLAUSE@8..30 0: JS_VARIABLE_DECLARATION@8..30 - 0: CONST_KW@8..14 "const" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@14..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" [] [] diff --git a/crates/rome_js_parser/test_data/inline/ok/ts_export_declare.rast b/crates/rome_js_parser/test_data/inline/ok/ts_export_declare.rast index 69a804e4e43..6d581484fb7 100644 --- a/crates/rome_js_parser/test_data/inline/ok/ts_export_declare.rast +++ b/crates/rome_js_parser/test_data/inline/ok/ts_export_declare.rast @@ -9,6 +9,7 @@ JsModule { 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 { @@ -141,8 +142,9 @@ JsModule { 0: DECLARE_KW@7..15 "declare" [] [Whitespace(" ")] 1: JS_VARIABLE_DECLARATION_CLAUSE@15..31 0: JS_VARIABLE_DECLARATION@15..30 - 0: CONST_KW@15..21 "const" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@21..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" [] [] diff --git a/crates/rome_js_parser/test_data/inline/ok/ts_export_type_specifier.rast b/crates/rome_js_parser/test_data/inline/ok/ts_export_type_specifier.rast index e2a69ae3d97..80271313a80 100644 --- a/crates/rome_js_parser/test_data/inline/ok/ts_export_type_specifier.rast +++ b/crates/rome_js_parser/test_data/inline/ok/ts_export_type_specifier.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@0..4 "let" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -19,6 +20,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@7..12 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -34,6 +36,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@17..22 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -199,8 +202,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..177 0: JS_VARIABLE_STATEMENT@0..7 0: JS_VARIABLE_DECLARATION@0..6 - 0: LET_KW@0..4 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@4..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" [] [] @@ -209,8 +213,9 @@ JsModule { 1: SEMICOLON@6..7 ";" [] [] 1: JS_VARIABLE_STATEMENT@7..17 0: JS_VARIABLE_DECLARATION@7..16 - 0: LET_KW@7..12 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@12..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" [] [] @@ -219,8 +224,9 @@ JsModule { 1: SEMICOLON@16..17 ";" [] [] 2: JS_VARIABLE_STATEMENT@17..24 0: JS_VARIABLE_DECLARATION@17..23 - 0: LET_KW@17..22 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@22..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" [] [] diff --git a/crates/rome_js_parser/test_data/inline/ok/ts_global_declaration.rast b/crates/rome_js_parser/test_data/inline/ok/ts_global_declaration.rast index b55c988bab7..965c0ed63ba 100644 --- a/crates/rome_js_parser/test_data/inline/ok/ts_global_declaration.rast +++ b/crates/rome_js_parser/test_data/inline/ok/ts_global_declaration.rast @@ -19,6 +19,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@35..45 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -70,8 +71,9 @@ JsModule { 1: JS_MODULE_ITEM_LIST@35..61 0: JS_VARIABLE_STATEMENT@35..61 0: JS_VARIABLE_DECLARATION@35..60 - 0: LET_KW@35..45 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@45..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" [] [] diff --git a/crates/rome_js_parser/test_data/inline/ok/ts_global_variable.rast b/crates/rome_js_parser/test_data/inline/ok/ts_global_variable.rast index aa2c2aee96a..bc3a807f6ed 100644 --- a/crates/rome_js_parser/test_data/inline/ok/ts_global_variable.rast +++ b/crates/rome_js_parser/test_data/inline/ok/ts_global_variable.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@0..4 "let" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -62,8 +63,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..64 0: JS_VARIABLE_STATEMENT@0..11 0: JS_VARIABLE_DECLARATION@0..10 - 0: LET_KW@0..4 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@4..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" [] [] diff --git a/crates/rome_js_parser/test_data/inline/ok/ts_instantiation_expressions.rast b/crates/rome_js_parser/test_data/inline/ok/ts_instantiation_expressions.rast index c12f12e27d0..904f1472aac 100644 --- a/crates/rome_js_parser/test_data/inline/ok/ts_instantiation_expressions.rast +++ b/crates/rome_js_parser/test_data/inline/ok/ts_instantiation_expressions.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@0..4 "let" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -37,6 +38,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@20..25 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -74,6 +76,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@49..54 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -115,6 +118,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: CONST_KW@78..85 "const" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -154,6 +158,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: CONST_KW@119..126 "const" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -195,6 +200,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: CONST_KW@163..170 "const" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -240,6 +246,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: CONST_KW@192..199 "const" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -282,6 +289,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: CONST_KW@234..241 "const" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -321,6 +329,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: CONST_KW@260..267 "const" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -363,6 +372,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: CONST_KW@286..293 "const" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -413,6 +423,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: CONST_KW@363..370 "const" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -456,6 +467,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: CONST_KW@390..397 "const" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -495,6 +507,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: CONST_KW@415..422 "const" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -998,8 +1011,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..588 0: JS_VARIABLE_STATEMENT@0..20 0: JS_VARIABLE_DECLARATION@0..19 - 0: LET_KW@0..4 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@4..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(" ")] @@ -1019,8 +1033,9 @@ JsModule { 1: SEMICOLON@19..20 ";" [] [] 1: JS_VARIABLE_STATEMENT@20..49 0: JS_VARIABLE_DECLARATION@20..48 - 0: LET_KW@20..25 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@25..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(" ")] @@ -1043,8 +1058,9 @@ JsModule { 1: SEMICOLON@48..49 ";" [] [] 2: JS_VARIABLE_STATEMENT@49..78 0: JS_VARIABLE_DECLARATION@49..77 - 0: LET_KW@49..54 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@54..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(" ")] @@ -1070,8 +1086,9 @@ JsModule { 1: SEMICOLON@77..78 ";" [] [] 3: JS_VARIABLE_STATEMENT@78..119 0: JS_VARIABLE_DECLARATION@78..101 - 0: CONST_KW@78..85 "const" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@85..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(" ")] @@ -1095,8 +1112,9 @@ JsModule { 1: SEMICOLON@101..119 ";" [] [Whitespace(" "), Comments("// () => number")] 4: JS_VARIABLE_STATEMENT@119..163 0: JS_VARIABLE_DECLARATION@119..145 - 0: CONST_KW@119..126 "const" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@126..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(" ")] @@ -1122,8 +1140,9 @@ JsModule { 1: SEMICOLON@145..163 ";" [] [Whitespace(" "), Comments("// () => number")] 5: JS_VARIABLE_STATEMENT@163..192 0: JS_VARIABLE_DECLARATION@163..191 - 0: CONST_KW@163..170 "const" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@170..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(" ")] @@ -1152,8 +1171,9 @@ JsModule { 1: SEMICOLON@191..192 ";" [] [] 6: JS_VARIABLE_STATEMENT@192..234 0: JS_VARIABLE_DECLARATION@192..218 - 0: CONST_KW@192..199 "const" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@199..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(" ")] @@ -1179,8 +1199,9 @@ JsModule { 1: SEMICOLON@218..234 ";" [] [Whitespace(" "), Comments("// type Error")] 7: JS_VARIABLE_STATEMENT@234..260 0: JS_VARIABLE_DECLARATION@234..259 - 0: CONST_KW@234..241 "const" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@241..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(" ")] @@ -1205,8 +1226,9 @@ JsModule { 1: SEMICOLON@259..260 ";" [] [] 8: JS_VARIABLE_STATEMENT@260..286 0: JS_VARIABLE_DECLARATION@260..285 - 0: CONST_KW@260..267 "const" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@267..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(" ")] @@ -1233,8 +1255,9 @@ JsModule { 1: SEMICOLON@285..286 ";" [] [] 9: JS_VARIABLE_STATEMENT@286..363 0: JS_VARIABLE_DECLARATION@286..319 - 0: CONST_KW@286..293 "const" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@293..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(" ")] @@ -1266,8 +1289,9 @@ JsModule { 1: SEMICOLON@319..363 ";" [] [Whitespace(" "), Comments("// Type Error, expect ...")] 10: JS_VARIABLE_STATEMENT@363..390 0: JS_VARIABLE_DECLARATION@363..389 - 0: CONST_KW@363..370 "const" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@370..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(" ")] @@ -1294,8 +1318,9 @@ JsModule { 1: SEMICOLON@389..390 ";" [] [] 11: JS_VARIABLE_STATEMENT@390..409 0: JS_VARIABLE_DECLARATION@390..409 - 0: CONST_KW@390..397 "const" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@397..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(" ")] @@ -1319,8 +1344,9 @@ JsModule { 1: SEMICOLON@414..415 ";" [] [] 13: JS_VARIABLE_STATEMENT@415..435 0: JS_VARIABLE_DECLARATION@415..434 - 0: CONST_KW@415..422 "const" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@422..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(" ")] diff --git a/crates/rome_js_parser/test_data/inline/ok/ts_instantiation_expressions_asi.rast b/crates/rome_js_parser/test_data/inline/ok/ts_instantiation_expressions_asi.rast index a47658cba95..4ef82680773 100644 --- a/crates/rome_js_parser/test_data/inline/ok/ts_instantiation_expressions_asi.rast +++ b/crates/rome_js_parser/test_data/inline/ok/ts_instantiation_expressions_asi.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: CONST_KW@0..6 "const" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -37,6 +38,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@18..23 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -57,6 +59,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: CONST_KW@30..37 "const" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -101,6 +104,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@64..69 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -155,6 +159,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@93..98 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -209,6 +214,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@129..134 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -256,6 +262,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@158..163 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -306,6 +313,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@182..187 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -676,6 +684,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: CONST_KW@556..563 "const" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -709,6 +718,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: CONST_KW@580..587 "const" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -737,8 +747,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..596 0: JS_VARIABLE_STATEMENT@0..18 0: JS_VARIABLE_DECLARATION@0..18 - 0: CONST_KW@0..6 "const" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@6..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(" ")] @@ -758,8 +769,9 @@ JsModule { 1: (empty) 1: JS_VARIABLE_STATEMENT@18..30 0: JS_VARIABLE_DECLARATION@18..29 - 0: LET_KW@18..23 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@23..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(" ")] @@ -771,8 +783,9 @@ JsModule { 1: SEMICOLON@29..30 ";" [] [] 2: JS_VARIABLE_STATEMENT@30..49 0: JS_VARIABLE_DECLARATION@30..49 - 0: CONST_KW@30..37 "const" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@37..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(" ")] @@ -801,8 +814,9 @@ JsModule { 6: R_CURLY@63..64 "}" [] [] 4: JS_VARIABLE_STATEMENT@64..82 0: JS_VARIABLE_DECLARATION@64..82 - 0: LET_KW@64..69 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@69..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(" ")] @@ -837,8 +851,9 @@ JsModule { 1: (empty) 6: JS_VARIABLE_STATEMENT@93..111 0: JS_VARIABLE_DECLARATION@93..111 - 0: LET_KW@93..98 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@98..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(" ")] @@ -875,8 +890,9 @@ JsModule { 3: R_CURLY@128..129 "}" [] [] 8: JS_VARIABLE_STATEMENT@129..147 0: JS_VARIABLE_DECLARATION@129..147 - 0: LET_KW@129..134 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@134..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(" ")] @@ -908,8 +924,9 @@ JsModule { 9: R_CURLY@157..158 "}" [] [] 10: JS_VARIABLE_STATEMENT@158..176 0: JS_VARIABLE_DECLARATION@158..176 - 0: LET_KW@158..163 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@163..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(" ")] @@ -941,8 +958,9 @@ JsModule { 1: (empty) 12: JS_VARIABLE_STATEMENT@182..200 0: JS_VARIABLE_DECLARATION@182..200 - 0: LET_KW@182..187 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@187..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(" ")] @@ -1195,8 +1213,9 @@ JsModule { 9: R_CURLY@554..556 "}" [Newline("\n")] [] 19: JS_VARIABLE_STATEMENT@556..580 0: JS_VARIABLE_DECLARATION@556..580 - 0: CONST_KW@556..563 "const" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@563..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(" ")] @@ -1216,8 +1235,9 @@ JsModule { 1: (empty) 20: JS_VARIABLE_STATEMENT@580..596 0: JS_VARIABLE_DECLARATION@580..596 - 0: CONST_KW@580..587 "const" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@587..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(" ")] diff --git a/crates/rome_js_parser/test_data/inline/ok/ts_instantiation_expressions_new_line.rast b/crates/rome_js_parser/test_data/inline/ok/ts_instantiation_expressions_new_line.rast index a8b2093258d..e309fccf5bd 100644 --- a/crates/rome_js_parser/test_data/inline/ok/ts_instantiation_expressions_new_line.rast +++ b/crates/rome_js_parser/test_data/inline/ok/ts_instantiation_expressions_new_line.rast @@ -92,6 +92,7 @@ JsModule { statements: JsStatementList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: CONST_KW@69..80 "const" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -1664,8 +1665,9 @@ JsModule { 2: JS_STATEMENT_LIST@69..99 0: JS_VARIABLE_STATEMENT@69..88 0: JS_VARIABLE_DECLARATION@69..88 - 0: CONST_KW@69..80 "const" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@80..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(" ")] diff --git a/crates/rome_js_parser/test_data/inline/ok/ts_new_operator.rast b/crates/rome_js_parser/test_data/inline/ok/ts_new_operator.rast index c81c93aa2c2..5f6000f318f 100644 --- a/crates/rome_js_parser/test_data/inline/ok/ts_new_operator.rast +++ b/crates/rome_js_parser/test_data/inline/ok/ts_new_operator.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: VAR_KW@0..4 "var" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -39,6 +40,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: VAR_KW@30..35 "var" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -78,6 +80,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: VAR_KW@63..68 "var" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -109,6 +112,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: VAR_KW@96..101 "var" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -144,8 +148,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..129 0: JS_VARIABLE_STATEMENT@0..30 0: JS_VARIABLE_DECLARATION@0..22 - 0: VAR_KW@0..4 "var" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@4..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(" ")] @@ -167,8 +172,9 @@ JsModule { 1: SEMICOLON@22..30 ";" [] [Whitespace(" "), Comments("// Ok")] 1: JS_VARIABLE_STATEMENT@30..63 0: JS_VARIABLE_DECLARATION@30..56 - 0: VAR_KW@30..35 "var" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@35..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(" ")] @@ -193,8 +199,9 @@ JsModule { 1: SEMICOLON@56..63 ";" [] [Whitespace(" "), Comments("// OK")] 2: JS_VARIABLE_STATEMENT@63..96 0: JS_VARIABLE_DECLARATION@63..81 - 0: VAR_KW@63..68 "var" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@68..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(" ")] @@ -214,8 +221,9 @@ JsModule { 1: SEMICOLON@81..96 ";" [] [Whitespace(" "), Comments("// OK")] 3: JS_VARIABLE_STATEMENT@96..129 0: JS_VARIABLE_DECLARATION@96..112 - 0: VAR_KW@96..101 "var" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@101..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(" ")] diff --git a/crates/rome_js_parser/test_data/inline/ok/ts_non_null_assertion_expression.rast b/crates/rome_js_parser/test_data/inline/ok/ts_non_null_assertion_expression.rast index 7bcde59e217..45be0e09fec 100644 --- a/crates/rome_js_parser/test_data/inline/ok/ts_non_null_assertion_expression.rast +++ b/crates/rome_js_parser/test_data/inline/ok/ts_non_null_assertion_expression.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@0..4 "let" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -147,8 +148,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..67 0: JS_VARIABLE_STATEMENT@0..18 0: JS_VARIABLE_DECLARATION@0..17 - 0: LET_KW@0..4 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@4..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(" ")] diff --git a/crates/rome_js_parser/test_data/inline/ok/ts_non_null_assignment.rast b/crates/rome_js_parser/test_data/inline/ok/ts_non_null_assignment.rast index fb37e2af65a..38820d45d88 100644 --- a/crates/rome_js_parser/test_data/inline/ok/ts_non_null_assignment.rast +++ b/crates/rome_js_parser/test_data/inline/ok/ts_non_null_assignment.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@0..4 "let" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -34,6 +35,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@15..20 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -97,8 +99,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..46 0: JS_VARIABLE_STATEMENT@0..6 0: JS_VARIABLE_DECLARATION@0..5 - 0: LET_KW@0..4 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@4..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" [] [] @@ -117,8 +120,9 @@ JsModule { 1: SEMICOLON@14..15 ";" [] [] 2: JS_VARIABLE_STATEMENT@15..36 0: JS_VARIABLE_DECLARATION@15..35 - 0: LET_KW@15..20 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@20..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(" ")] diff --git a/crates/rome_js_parser/test_data/inline/ok/ts_return_type_annotation.rast b/crates/rome_js_parser/test_data/inline/ok/ts_return_type_annotation.rast index 0271c705fe0..d4e7615e4e0 100644 --- a/crates/rome_js_parser/test_data/inline/ok/ts_return_type_annotation.rast +++ b/crates/rome_js_parser/test_data/inline/ok/ts_return_type_annotation.rast @@ -137,6 +137,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: CONST_KW@92..99 "const" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -401,8 +402,9 @@ JsModule { 5: (empty) 3: JS_VARIABLE_STATEMENT@92..160 0: JS_VARIABLE_DECLARATION@92..160 - 0: CONST_KW@92..99 "const" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@99..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(" ")] diff --git a/crates/rome_js_parser/test_data/inline/ok/ts_satisfies_assignment.rast b/crates/rome_js_parser/test_data/inline/ok/ts_satisfies_assignment.rast index aeca3c4a99f..415a5691074 100644 --- a/crates/rome_js_parser/test_data/inline/ok/ts_satisfies_assignment.rast +++ b/crates/rome_js_parser/test_data/inline/ok/ts_satisfies_assignment.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@0..4 "let" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -282,8 +283,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..270 0: JS_VARIABLE_STATEMENT@0..11 0: JS_VARIABLE_DECLARATION@0..10 - 0: LET_KW@0..4 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@4..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" [] [] diff --git a/crates/rome_js_parser/test_data/inline/ok/ts_satisfies_expression.rast b/crates/rome_js_parser/test_data/inline/ok/ts_satisfies_expression.rast index efd440650e7..8e6fffe2775 100644 --- a/crates/rome_js_parser/test_data/inline/ok/ts_satisfies_expression.rast +++ b/crates/rome_js_parser/test_data/inline/ok/ts_satisfies_expression.rast @@ -33,6 +33,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@29..34 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -74,6 +75,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@64..69 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -125,6 +127,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: CONST_KW@110..117 "const" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -154,6 +157,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@143..148 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -184,6 +188,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@197..202 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -257,8 +262,9 @@ JsModule { 0: SEMICOLON@28..29 ";" [] [] 2: JS_VARIABLE_STATEMENT@29..64 0: JS_VARIABLE_DECLARATION@29..63 - 0: LET_KW@29..34 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@34..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(" ")] @@ -284,8 +290,9 @@ JsModule { 1: SEMICOLON@63..64 ";" [] [] 3: JS_VARIABLE_STATEMENT@64..110 0: JS_VARIABLE_DECLARATION@64..109 - 0: LET_KW@64..69 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@69..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(" ")] @@ -318,8 +325,9 @@ JsModule { 1: SEMICOLON@109..110 ";" [] [] 4: JS_VARIABLE_STATEMENT@110..143 0: JS_VARIABLE_DECLARATION@110..142 - 0: CONST_KW@110..117 "const" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@117..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(" ")] @@ -337,8 +345,9 @@ JsModule { 1: SEMICOLON@142..143 ";" [] [] 5: JS_VARIABLE_STATEMENT@143..186 0: JS_VARIABLE_DECLARATION@143..186 - 0: LET_KW@143..148 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@148..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(" ")] @@ -356,8 +365,9 @@ JsModule { 1: SEMICOLON@196..197 ";" [] [] 7: JS_VARIABLE_STATEMENT@197..278 0: JS_VARIABLE_DECLARATION@197..277 - 0: LET_KW@197..202 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@202..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(" ")] diff --git a/crates/rome_js_parser/test_data/inline/ok/ts_type_assertion.rast b/crates/rome_js_parser/test_data/inline/ok/ts_type_assertion.rast index 50b78bf3161..75459a436b5 100644 --- a/crates/rome_js_parser/test_data/inline/ok/ts_type_assertion.rast +++ b/crates/rome_js_parser/test_data/inline/ok/ts_type_assertion.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@0..4 "let" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -41,8 +42,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..18 0: JS_VARIABLE_STATEMENT@0..18 0: JS_VARIABLE_DECLARATION@0..17 - 0: LET_KW@0..4 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@4..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(" ")] diff --git a/crates/rome_js_parser/test_data/inline/ok/ts_type_assertion_expression.rast b/crates/rome_js_parser/test_data/inline/ok/ts_type_assertion_expression.rast index 4d24391079b..f85c2c61085 100644 --- a/crates/rome_js_parser/test_data/inline/ok/ts_type_assertion_expression.rast +++ b/crates/rome_js_parser/test_data/inline/ok/ts_type_assertion_expression.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@0..4 "let" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -34,6 +35,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@23..28 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -63,6 +65,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: VAR_KW@43..48 "var" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -127,8 +130,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..93 0: JS_VARIABLE_STATEMENT@0..23 0: JS_VARIABLE_DECLARATION@0..22 - 0: LET_KW@0..4 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@4..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(" ")] @@ -147,8 +151,9 @@ JsModule { 1: SEMICOLON@22..23 ";" [] [] 1: JS_VARIABLE_STATEMENT@23..43 0: JS_VARIABLE_DECLARATION@23..42 - 0: LET_KW@23..28 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@28..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(" ")] @@ -166,8 +171,9 @@ JsModule { 1: SEMICOLON@42..43 ";" [] [] 2: JS_VARIABLE_STATEMENT@43..93 0: JS_VARIABLE_DECLARATION@43..92 - 0: VAR_KW@43..48 "var" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@48..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(" ")] diff --git a/crates/rome_js_parser/test_data/inline/ok/ts_type_operator.rast b/crates/rome_js_parser/test_data/inline/ok/ts_type_operator.rast index 0ffa51df4b3..27d5250dde5 100644 --- a/crates/rome_js_parser/test_data/inline/ok/ts_type_operator.rast +++ b/crates/rome_js_parser/test_data/inline/ok/ts_type_operator.rast @@ -84,6 +84,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: CONST_KW@80..87 "const" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -189,8 +190,9 @@ JsModule { 5: SEMICOLON@79..80 ";" [] [] 3: JS_VARIABLE_STATEMENT@80..115 0: JS_VARIABLE_DECLARATION@80..114 - 0: CONST_KW@80..87 "const" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@87..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" [] [] diff --git a/crates/rome_js_parser/test_data/inline/ok/ts_type_variable.rast b/crates/rome_js_parser/test_data/inline/ok/ts_type_variable.rast index f68a500da61..3646790cb76 100644 --- a/crates/rome_js_parser/test_data/inline/ok/ts_type_variable.rast +++ b/crates/rome_js_parser/test_data/inline/ok/ts_type_variable.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@0..4 "let" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -80,8 +81,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..84 0: JS_VARIABLE_STATEMENT@0..9 0: JS_VARIABLE_DECLARATION@0..8 - 0: LET_KW@0..4 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@4..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" [] [] diff --git a/crates/rome_js_parser/test_data/inline/ok/ts_type_variable_annotation.rast b/crates/rome_js_parser/test_data/inline/ok/ts_type_variable_annotation.rast index 45c495a730e..7b03270c3c0 100644 --- a/crates/rome_js_parser/test_data/inline/ok/ts_type_variable_annotation.rast +++ b/crates/rome_js_parser/test_data/inline/ok/ts_type_variable_annotation.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@0..4 "let" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -45,6 +46,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@35..40 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -95,8 +97,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..68 0: JS_VARIABLE_STATEMENT@0..35 0: JS_VARIABLE_DECLARATION@0..34 - 0: LET_KW@0..4 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@4..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" [] [] @@ -122,8 +125,9 @@ JsModule { 1: SEMICOLON@34..35 ";" [] [] 1: JS_VARIABLE_STATEMENT@35..48 0: JS_VARIABLE_DECLARATION@35..48 - 0: LET_KW@35..40 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@40..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")] diff --git a/crates/rome_js_parser/test_data/inline/ok/ts_typeof_type.rast b/crates/rome_js_parser/test_data/inline/ok/ts_typeof_type.rast index af849fab80e..a0d123baf93 100644 --- a/crates/rome_js_parser/test_data/inline/ok/ts_typeof_type.rast +++ b/crates/rome_js_parser/test_data/inline/ok/ts_typeof_type.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@0..4 "let" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -123,8 +124,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..110 0: JS_VARIABLE_STATEMENT@0..15 0: JS_VARIABLE_DECLARATION@0..14 - 0: LET_KW@0..4 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@4..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(" ")] diff --git a/crates/rome_js_parser/test_data/inline/ok/type_arguments_no_recovery.rast b/crates/rome_js_parser/test_data/inline/ok/type_arguments_no_recovery.rast index 55484b51d30..3e8c3fc6d0f 100644 --- a/crates/rome_js_parser/test_data/inline/ok/type_arguments_no_recovery.rast +++ b/crates/rome_js_parser/test_data/inline/ok/type_arguments_no_recovery.rast @@ -6,6 +6,7 @@ JsModule { 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 { @@ -239,8 +240,9 @@ JsModule { 0: FOR_KW@0..4 "for" [] [Whitespace(" ")] 1: L_PAREN@4..5 "(" [] [] 2: JS_VARIABLE_DECLARATION@5..15 - 0: LET_KW@5..9 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@9..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(" ")] diff --git a/crates/rome_js_parser/test_data/inline/ok/type_assertion_primary_expression.rast b/crates/rome_js_parser/test_data/inline/ok/type_assertion_primary_expression.rast index 445e53a0580..d18cb268a34 100644 --- a/crates/rome_js_parser/test_data/inline/ok/type_assertion_primary_expression.rast +++ b/crates/rome_js_parser/test_data/inline/ok/type_assertion_primary_expression.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@0..4 "let" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -41,8 +42,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..26 0: JS_VARIABLE_STATEMENT@0..26 0: JS_VARIABLE_DECLARATION@0..25 - 0: LET_KW@0..4 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@4..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(" ")] diff --git a/crates/rome_js_parser/test_data/inline/ok/type_parameter_modifier.rast b/crates/rome_js_parser/test_data/inline/ok/type_parameter_modifier.rast index bc48d967b32..25730270abd 100644 --- a/crates/rome_js_parser/test_data/inline/ok/type_parameter_modifier.rast +++ b/crates/rome_js_parser/test_data/inline/ok/type_parameter_modifier.rast @@ -1649,6 +1649,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: CONST_KW@1152..1159 "const" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -2952,8 +2953,9 @@ JsModule { 2: R_CURLY@1150..1152 "}" [Newline("\n")] [] 41: JS_VARIABLE_STATEMENT@1152..1214 0: JS_VARIABLE_DECLARATION@1152..1214 - 0: CONST_KW@1152..1159 "const" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@1159..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(" ")] diff --git a/crates/rome_js_parser/test_data/inline/ok/using_declaration_statement.js b/crates/rome_js_parser/test_data/inline/ok/using_declaration_statement.js new file mode 100644 index 00000000000..bb0a1b646b6 --- /dev/null +++ b/crates/rome_js_parser/test_data/inline/ok/using_declaration_statement.js @@ -0,0 +1,15 @@ +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); diff --git a/crates/rome_js_parser/test_data/inline/ok/using_declaration_statement.rast b/crates/rome_js_parser/test_data/inline/ok/using_declaration_statement.rast new file mode 100644 index 00000000000..95ec0a05537 --- /dev/null +++ b/crates/rome_js_parser/test_data/inline/ok/using_declaration_statement.rast @@ -0,0 +1,593 @@ +JsModule { + 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 [ + JsIdentifierAssignment { + name_token: IDENT@131..132 "s" [] [], + }, + ], + 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: JS_DIRECTIVE_LIST@0..0 + 2: 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_IDENTIFIER_ASSIGNMENT@131..132 + 0: IDENT@131..132 "s" [] [] + 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 ";" [] [] + 3: EOF@235..236 "" [Newline("\n")] [] diff --git a/crates/rome_js_parser/test_data/inline/ok/using_declarations_inside_for_statement.js b/crates/rome_js_parser/test_data/inline/ok/using_declarations_inside_for_statement.js new file mode 100644 index 00000000000..b9482db759c --- /dev/null +++ b/crates/rome_js_parser/test_data/inline/ok/using_declarations_inside_for_statement.js @@ -0,0 +1,4 @@ +for (using x of y) {}; +for await (using x of y) {}; +for (await using x of y) {}; +for await (await using x of y) {}; diff --git a/crates/rome_js_parser/test_data/inline/ok/using_declarations_inside_for_statement.rast b/crates/rome_js_parser/test_data/inline/ok/using_declarations_inside_for_statement.rast new file mode 100644 index 00000000000..f3d9bd49742 --- /dev/null +++ b/crates/rome_js_parser/test_data/inline/ok/using_declarations_inside_for_statement.rast @@ -0,0 +1,229 @@ +JsModule { + 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: JS_DIRECTIVE_LIST@0..0 + 2: 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 ";" [] [] + 3: EOF@115..116 "" [Newline("\n")] [] diff --git a/crates/rome_js_parser/test_data/inline/ok/var_decl.rast b/crates/rome_js_parser/test_data/inline/ok/var_decl.rast index c959d9bbb4b..b72dda4a245 100644 --- a/crates/rome_js_parser/test_data/inline/ok/var_decl.rast +++ b/crates/rome_js_parser/test_data/inline/ok/var_decl.rast @@ -4,6 +4,7 @@ JsModule { items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: VAR_KW@0..4 "var" [] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -24,6 +25,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@10..15 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -60,6 +62,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@32..37 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -83,6 +86,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: CONST_KW@48..55 "const" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -103,6 +107,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: CONST_KW@61..68 "const" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -151,6 +156,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: LET_KW@97..102 "let" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -210,6 +216,7 @@ JsModule { }, JsVariableStatement { declaration: JsVariableDeclaration { + await_token: missing (optional), kind: VAR_KW@163..168 "var" [Newline("\n")] [Whitespace(" ")], declarators: JsVariableDeclaratorList [ JsVariableDeclarator { @@ -265,8 +272,9 @@ JsModule { 2: JS_MODULE_ITEM_LIST@0..182 0: JS_VARIABLE_STATEMENT@0..10 0: JS_VARIABLE_DECLARATION@0..9 - 0: VAR_KW@0..4 "var" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@4..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(" ")] @@ -278,8 +286,9 @@ JsModule { 1: SEMICOLON@9..10 ";" [] [] 1: JS_VARIABLE_STATEMENT@10..32 0: JS_VARIABLE_DECLARATION@10..31 - 0: LET_KW@10..15 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@15..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(" ")] @@ -302,8 +311,9 @@ JsModule { 1: SEMICOLON@31..32 ";" [] [] 2: JS_VARIABLE_STATEMENT@32..48 0: JS_VARIABLE_DECLARATION@32..47 - 0: LET_KW@32..37 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@37..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" [] [] @@ -318,8 +328,9 @@ JsModule { 1: SEMICOLON@47..48 ";" [] [] 3: JS_VARIABLE_STATEMENT@48..61 0: JS_VARIABLE_DECLARATION@48..60 - 0: CONST_KW@48..55 "const" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@55..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(" ")] @@ -331,8 +342,9 @@ JsModule { 1: SEMICOLON@60..61 ";" [] [] 4: JS_VARIABLE_STATEMENT@61..97 0: JS_VARIABLE_DECLARATION@61..96 - 0: CONST_KW@61..68 "const" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@68..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(" ")] @@ -364,8 +376,9 @@ JsModule { 1: SEMICOLON@96..97 ";" [] [] 5: JS_VARIABLE_STATEMENT@97..163 0: JS_VARIABLE_DECLARATION@97..162 - 0: LET_KW@97..102 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@102..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(" ")] @@ -404,8 +417,9 @@ JsModule { 1: SEMICOLON@162..163 ";" [] [] 6: JS_VARIABLE_STATEMENT@163..182 0: JS_VARIABLE_DECLARATION@163..181 - 0: VAR_KW@163..168 "var" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@168..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" [] [] diff --git a/crates/rome_js_syntax/src/generated/kind.rs b/crates/rome_js_syntax/src/generated/kind.rs index f9c527c5377..5e542c675f0 100644 --- a/crates/rome_js_syntax/src/generated/kind.rs +++ b/crates/rome_js_syntax/src/generated/kind.rs @@ -150,6 +150,7 @@ pub enum JsSyntaxKind { OVERRIDE_KW, OF_KW, OUT_KW, + USING_KW, JS_NUMBER_LITERAL, JS_BIGINT_LITERAL, JS_STRING_LITERAL, @@ -656,6 +657,7 @@ impl JsSyntaxKind { "override" => OVERRIDE_KW, "of" => OF_KW, "out" => OUT_KW, + "using" => USING_KW, _ => return None, }; Some(kw) @@ -802,6 +804,7 @@ impl JsSyntaxKind { OVERRIDE_KW => "override", OF_KW => "of", OUT_KW => "out", + USING_KW => "using", JS_STRING_LITERAL => "string literal", _ => return None, }; @@ -810,4 +813,4 @@ impl JsSyntaxKind { } #[doc = r" Utility macro for creating a SyntaxKind through simple macro syntax"] #[macro_export] -macro_rules ! T { [;] => { $ crate :: JsSyntaxKind :: SEMICOLON } ; [,] => { $ crate :: JsSyntaxKind :: COMMA } ; ['('] => { $ crate :: JsSyntaxKind :: L_PAREN } ; [')'] => { $ crate :: JsSyntaxKind :: R_PAREN } ; ['{'] => { $ crate :: JsSyntaxKind :: L_CURLY } ; ['}'] => { $ crate :: JsSyntaxKind :: R_CURLY } ; ['['] => { $ crate :: JsSyntaxKind :: L_BRACK } ; [']'] => { $ crate :: JsSyntaxKind :: R_BRACK } ; [<] => { $ crate :: JsSyntaxKind :: L_ANGLE } ; [>] => { $ crate :: JsSyntaxKind :: R_ANGLE } ; [~] => { $ crate :: JsSyntaxKind :: TILDE } ; [?] => { $ crate :: JsSyntaxKind :: QUESTION } ; [??] => { $ crate :: JsSyntaxKind :: QUESTION2 } ; [?.] => { $ crate :: JsSyntaxKind :: QUESTIONDOT } ; [&] => { $ crate :: JsSyntaxKind :: AMP } ; [|] => { $ crate :: JsSyntaxKind :: PIPE } ; [+] => { $ crate :: JsSyntaxKind :: PLUS } ; [++] => { $ crate :: JsSyntaxKind :: PLUS2 } ; [*] => { $ crate :: JsSyntaxKind :: STAR } ; [**] => { $ crate :: JsSyntaxKind :: STAR2 } ; [/] => { $ crate :: JsSyntaxKind :: SLASH } ; [^] => { $ crate :: JsSyntaxKind :: CARET } ; [%] => { $ crate :: JsSyntaxKind :: PERCENT } ; [.] => { $ crate :: JsSyntaxKind :: DOT } ; [...] => { $ crate :: JsSyntaxKind :: DOT3 } ; [:] => { $ crate :: JsSyntaxKind :: COLON } ; [=] => { $ crate :: JsSyntaxKind :: EQ } ; [==] => { $ crate :: JsSyntaxKind :: EQ2 } ; [===] => { $ crate :: JsSyntaxKind :: EQ3 } ; [=>] => { $ crate :: JsSyntaxKind :: FAT_ARROW } ; [!] => { $ crate :: JsSyntaxKind :: BANG } ; [!=] => { $ crate :: JsSyntaxKind :: NEQ } ; [!==] => { $ crate :: JsSyntaxKind :: NEQ2 } ; [-] => { $ crate :: JsSyntaxKind :: MINUS } ; [--] => { $ crate :: JsSyntaxKind :: MINUS2 } ; [<=] => { $ crate :: JsSyntaxKind :: LTEQ } ; [>=] => { $ crate :: JsSyntaxKind :: GTEQ } ; [+=] => { $ crate :: JsSyntaxKind :: PLUSEQ } ; [-=] => { $ crate :: JsSyntaxKind :: MINUSEQ } ; [|=] => { $ crate :: JsSyntaxKind :: PIPEEQ } ; [&=] => { $ crate :: JsSyntaxKind :: AMPEQ } ; [^=] => { $ crate :: JsSyntaxKind :: CARETEQ } ; [/=] => { $ crate :: JsSyntaxKind :: SLASHEQ } ; [*=] => { $ crate :: JsSyntaxKind :: STAREQ } ; [%=] => { $ crate :: JsSyntaxKind :: PERCENTEQ } ; [&&] => { $ crate :: JsSyntaxKind :: AMP2 } ; [||] => { $ crate :: JsSyntaxKind :: PIPE2 } ; [<<] => { $ crate :: JsSyntaxKind :: SHL } ; [>>] => { $ crate :: JsSyntaxKind :: SHR } ; [>>>] => { $ crate :: JsSyntaxKind :: USHR } ; [<<=] => { $ crate :: JsSyntaxKind :: SHLEQ } ; [>>=] => { $ crate :: JsSyntaxKind :: SHREQ } ; [>>>=] => { $ crate :: JsSyntaxKind :: USHREQ } ; [&&=] => { $ crate :: JsSyntaxKind :: AMP2EQ } ; [||=] => { $ crate :: JsSyntaxKind :: PIPE2EQ } ; [**=] => { $ crate :: JsSyntaxKind :: STAR2EQ } ; [??=] => { $ crate :: JsSyntaxKind :: QUESTION2EQ } ; [@] => { $ crate :: JsSyntaxKind :: AT } ; ['`'] => { $ crate :: JsSyntaxKind :: BACKTICK } ; [break] => { $ crate :: JsSyntaxKind :: BREAK_KW } ; [case] => { $ crate :: JsSyntaxKind :: CASE_KW } ; [catch] => { $ crate :: JsSyntaxKind :: CATCH_KW } ; [class] => { $ crate :: JsSyntaxKind :: CLASS_KW } ; [const] => { $ crate :: JsSyntaxKind :: CONST_KW } ; [continue] => { $ crate :: JsSyntaxKind :: CONTINUE_KW } ; [debugger] => { $ crate :: JsSyntaxKind :: DEBUGGER_KW } ; [default] => { $ crate :: JsSyntaxKind :: DEFAULT_KW } ; [delete] => { $ crate :: JsSyntaxKind :: DELETE_KW } ; [do] => { $ crate :: JsSyntaxKind :: DO_KW } ; [else] => { $ crate :: JsSyntaxKind :: ELSE_KW } ; [enum] => { $ crate :: JsSyntaxKind :: ENUM_KW } ; [export] => { $ crate :: JsSyntaxKind :: EXPORT_KW } ; [extends] => { $ crate :: JsSyntaxKind :: EXTENDS_KW } ; [false] => { $ crate :: JsSyntaxKind :: FALSE_KW } ; [finally] => { $ crate :: JsSyntaxKind :: FINALLY_KW } ; [for] => { $ crate :: JsSyntaxKind :: FOR_KW } ; [function] => { $ crate :: JsSyntaxKind :: FUNCTION_KW } ; [if] => { $ crate :: JsSyntaxKind :: IF_KW } ; [in] => { $ crate :: JsSyntaxKind :: IN_KW } ; [instanceof] => { $ crate :: JsSyntaxKind :: INSTANCEOF_KW } ; [import] => { $ crate :: JsSyntaxKind :: IMPORT_KW } ; [new] => { $ crate :: JsSyntaxKind :: NEW_KW } ; [null] => { $ crate :: JsSyntaxKind :: NULL_KW } ; [return] => { $ crate :: JsSyntaxKind :: RETURN_KW } ; [super] => { $ crate :: JsSyntaxKind :: SUPER_KW } ; [switch] => { $ crate :: JsSyntaxKind :: SWITCH_KW } ; [this] => { $ crate :: JsSyntaxKind :: THIS_KW } ; [throw] => { $ crate :: JsSyntaxKind :: THROW_KW } ; [try] => { $ crate :: JsSyntaxKind :: TRY_KW } ; [true] => { $ crate :: JsSyntaxKind :: TRUE_KW } ; [typeof] => { $ crate :: JsSyntaxKind :: TYPEOF_KW } ; [var] => { $ crate :: JsSyntaxKind :: VAR_KW } ; [void] => { $ crate :: JsSyntaxKind :: VOID_KW } ; [while] => { $ crate :: JsSyntaxKind :: WHILE_KW } ; [with] => { $ crate :: JsSyntaxKind :: WITH_KW } ; [implements] => { $ crate :: JsSyntaxKind :: IMPLEMENTS_KW } ; [interface] => { $ crate :: JsSyntaxKind :: INTERFACE_KW } ; [let] => { $ crate :: JsSyntaxKind :: LET_KW } ; [package] => { $ crate :: JsSyntaxKind :: PACKAGE_KW } ; [private] => { $ crate :: JsSyntaxKind :: PRIVATE_KW } ; [protected] => { $ crate :: JsSyntaxKind :: PROTECTED_KW } ; [public] => { $ crate :: JsSyntaxKind :: PUBLIC_KW } ; [static] => { $ crate :: JsSyntaxKind :: STATIC_KW } ; [yield] => { $ crate :: JsSyntaxKind :: YIELD_KW } ; [abstract] => { $ crate :: JsSyntaxKind :: ABSTRACT_KW } ; [accessor] => { $ crate :: JsSyntaxKind :: ACCESSOR_KW } ; [as] => { $ crate :: JsSyntaxKind :: AS_KW } ; [satisfies] => { $ crate :: JsSyntaxKind :: SATISFIES_KW } ; [asserts] => { $ crate :: JsSyntaxKind :: ASSERTS_KW } ; [assert] => { $ crate :: JsSyntaxKind :: ASSERT_KW } ; [any] => { $ crate :: JsSyntaxKind :: ANY_KW } ; [async] => { $ crate :: JsSyntaxKind :: ASYNC_KW } ; [await] => { $ crate :: JsSyntaxKind :: AWAIT_KW } ; [boolean] => { $ crate :: JsSyntaxKind :: BOOLEAN_KW } ; [constructor] => { $ crate :: JsSyntaxKind :: CONSTRUCTOR_KW } ; [declare] => { $ crate :: JsSyntaxKind :: DECLARE_KW } ; [get] => { $ crate :: JsSyntaxKind :: GET_KW } ; [infer] => { $ crate :: JsSyntaxKind :: INFER_KW } ; [is] => { $ crate :: JsSyntaxKind :: IS_KW } ; [keyof] => { $ crate :: JsSyntaxKind :: KEYOF_KW } ; [module] => { $ crate :: JsSyntaxKind :: MODULE_KW } ; [namespace] => { $ crate :: JsSyntaxKind :: NAMESPACE_KW } ; [never] => { $ crate :: JsSyntaxKind :: NEVER_KW } ; [readonly] => { $ crate :: JsSyntaxKind :: READONLY_KW } ; [require] => { $ crate :: JsSyntaxKind :: REQUIRE_KW } ; [number] => { $ crate :: JsSyntaxKind :: NUMBER_KW } ; [object] => { $ crate :: JsSyntaxKind :: OBJECT_KW } ; [set] => { $ crate :: JsSyntaxKind :: SET_KW } ; [string] => { $ crate :: JsSyntaxKind :: STRING_KW } ; [symbol] => { $ crate :: JsSyntaxKind :: SYMBOL_KW } ; [type] => { $ crate :: JsSyntaxKind :: TYPE_KW } ; [undefined] => { $ crate :: JsSyntaxKind :: UNDEFINED_KW } ; [unique] => { $ crate :: JsSyntaxKind :: UNIQUE_KW } ; [unknown] => { $ crate :: JsSyntaxKind :: UNKNOWN_KW } ; [from] => { $ crate :: JsSyntaxKind :: FROM_KW } ; [global] => { $ crate :: JsSyntaxKind :: GLOBAL_KW } ; [bigint] => { $ crate :: JsSyntaxKind :: BIGINT_KW } ; [override] => { $ crate :: JsSyntaxKind :: OVERRIDE_KW } ; [of] => { $ crate :: JsSyntaxKind :: OF_KW } ; [out] => { $ crate :: JsSyntaxKind :: OUT_KW } ; [ident] => { $ crate :: JsSyntaxKind :: IDENT } ; [EOF] => { $ crate :: JsSyntaxKind :: EOF } ; [#] => { $ crate :: JsSyntaxKind :: HASH } ; } +macro_rules ! T { [;] => { $ crate :: JsSyntaxKind :: SEMICOLON } ; [,] => { $ crate :: JsSyntaxKind :: COMMA } ; ['('] => { $ crate :: JsSyntaxKind :: L_PAREN } ; [')'] => { $ crate :: JsSyntaxKind :: R_PAREN } ; ['{'] => { $ crate :: JsSyntaxKind :: L_CURLY } ; ['}'] => { $ crate :: JsSyntaxKind :: R_CURLY } ; ['['] => { $ crate :: JsSyntaxKind :: L_BRACK } ; [']'] => { $ crate :: JsSyntaxKind :: R_BRACK } ; [<] => { $ crate :: JsSyntaxKind :: L_ANGLE } ; [>] => { $ crate :: JsSyntaxKind :: R_ANGLE } ; [~] => { $ crate :: JsSyntaxKind :: TILDE } ; [?] => { $ crate :: JsSyntaxKind :: QUESTION } ; [??] => { $ crate :: JsSyntaxKind :: QUESTION2 } ; [?.] => { $ crate :: JsSyntaxKind :: QUESTIONDOT } ; [&] => { $ crate :: JsSyntaxKind :: AMP } ; [|] => { $ crate :: JsSyntaxKind :: PIPE } ; [+] => { $ crate :: JsSyntaxKind :: PLUS } ; [++] => { $ crate :: JsSyntaxKind :: PLUS2 } ; [*] => { $ crate :: JsSyntaxKind :: STAR } ; [**] => { $ crate :: JsSyntaxKind :: STAR2 } ; [/] => { $ crate :: JsSyntaxKind :: SLASH } ; [^] => { $ crate :: JsSyntaxKind :: CARET } ; [%] => { $ crate :: JsSyntaxKind :: PERCENT } ; [.] => { $ crate :: JsSyntaxKind :: DOT } ; [...] => { $ crate :: JsSyntaxKind :: DOT3 } ; [:] => { $ crate :: JsSyntaxKind :: COLON } ; [=] => { $ crate :: JsSyntaxKind :: EQ } ; [==] => { $ crate :: JsSyntaxKind :: EQ2 } ; [===] => { $ crate :: JsSyntaxKind :: EQ3 } ; [=>] => { $ crate :: JsSyntaxKind :: FAT_ARROW } ; [!] => { $ crate :: JsSyntaxKind :: BANG } ; [!=] => { $ crate :: JsSyntaxKind :: NEQ } ; [!==] => { $ crate :: JsSyntaxKind :: NEQ2 } ; [-] => { $ crate :: JsSyntaxKind :: MINUS } ; [--] => { $ crate :: JsSyntaxKind :: MINUS2 } ; [<=] => { $ crate :: JsSyntaxKind :: LTEQ } ; [>=] => { $ crate :: JsSyntaxKind :: GTEQ } ; [+=] => { $ crate :: JsSyntaxKind :: PLUSEQ } ; [-=] => { $ crate :: JsSyntaxKind :: MINUSEQ } ; [|=] => { $ crate :: JsSyntaxKind :: PIPEEQ } ; [&=] => { $ crate :: JsSyntaxKind :: AMPEQ } ; [^=] => { $ crate :: JsSyntaxKind :: CARETEQ } ; [/=] => { $ crate :: JsSyntaxKind :: SLASHEQ } ; [*=] => { $ crate :: JsSyntaxKind :: STAREQ } ; [%=] => { $ crate :: JsSyntaxKind :: PERCENTEQ } ; [&&] => { $ crate :: JsSyntaxKind :: AMP2 } ; [||] => { $ crate :: JsSyntaxKind :: PIPE2 } ; [<<] => { $ crate :: JsSyntaxKind :: SHL } ; [>>] => { $ crate :: JsSyntaxKind :: SHR } ; [>>>] => { $ crate :: JsSyntaxKind :: USHR } ; [<<=] => { $ crate :: JsSyntaxKind :: SHLEQ } ; [>>=] => { $ crate :: JsSyntaxKind :: SHREQ } ; [>>>=] => { $ crate :: JsSyntaxKind :: USHREQ } ; [&&=] => { $ crate :: JsSyntaxKind :: AMP2EQ } ; [||=] => { $ crate :: JsSyntaxKind :: PIPE2EQ } ; [**=] => { $ crate :: JsSyntaxKind :: STAR2EQ } ; [??=] => { $ crate :: JsSyntaxKind :: QUESTION2EQ } ; [@] => { $ crate :: JsSyntaxKind :: AT } ; ['`'] => { $ crate :: JsSyntaxKind :: BACKTICK } ; [break] => { $ crate :: JsSyntaxKind :: BREAK_KW } ; [case] => { $ crate :: JsSyntaxKind :: CASE_KW } ; [catch] => { $ crate :: JsSyntaxKind :: CATCH_KW } ; [class] => { $ crate :: JsSyntaxKind :: CLASS_KW } ; [const] => { $ crate :: JsSyntaxKind :: CONST_KW } ; [continue] => { $ crate :: JsSyntaxKind :: CONTINUE_KW } ; [debugger] => { $ crate :: JsSyntaxKind :: DEBUGGER_KW } ; [default] => { $ crate :: JsSyntaxKind :: DEFAULT_KW } ; [delete] => { $ crate :: JsSyntaxKind :: DELETE_KW } ; [do] => { $ crate :: JsSyntaxKind :: DO_KW } ; [else] => { $ crate :: JsSyntaxKind :: ELSE_KW } ; [enum] => { $ crate :: JsSyntaxKind :: ENUM_KW } ; [export] => { $ crate :: JsSyntaxKind :: EXPORT_KW } ; [extends] => { $ crate :: JsSyntaxKind :: EXTENDS_KW } ; [false] => { $ crate :: JsSyntaxKind :: FALSE_KW } ; [finally] => { $ crate :: JsSyntaxKind :: FINALLY_KW } ; [for] => { $ crate :: JsSyntaxKind :: FOR_KW } ; [function] => { $ crate :: JsSyntaxKind :: FUNCTION_KW } ; [if] => { $ crate :: JsSyntaxKind :: IF_KW } ; [in] => { $ crate :: JsSyntaxKind :: IN_KW } ; [instanceof] => { $ crate :: JsSyntaxKind :: INSTANCEOF_KW } ; [import] => { $ crate :: JsSyntaxKind :: IMPORT_KW } ; [new] => { $ crate :: JsSyntaxKind :: NEW_KW } ; [null] => { $ crate :: JsSyntaxKind :: NULL_KW } ; [return] => { $ crate :: JsSyntaxKind :: RETURN_KW } ; [super] => { $ crate :: JsSyntaxKind :: SUPER_KW } ; [switch] => { $ crate :: JsSyntaxKind :: SWITCH_KW } ; [this] => { $ crate :: JsSyntaxKind :: THIS_KW } ; [throw] => { $ crate :: JsSyntaxKind :: THROW_KW } ; [try] => { $ crate :: JsSyntaxKind :: TRY_KW } ; [true] => { $ crate :: JsSyntaxKind :: TRUE_KW } ; [typeof] => { $ crate :: JsSyntaxKind :: TYPEOF_KW } ; [var] => { $ crate :: JsSyntaxKind :: VAR_KW } ; [void] => { $ crate :: JsSyntaxKind :: VOID_KW } ; [while] => { $ crate :: JsSyntaxKind :: WHILE_KW } ; [with] => { $ crate :: JsSyntaxKind :: WITH_KW } ; [implements] => { $ crate :: JsSyntaxKind :: IMPLEMENTS_KW } ; [interface] => { $ crate :: JsSyntaxKind :: INTERFACE_KW } ; [let] => { $ crate :: JsSyntaxKind :: LET_KW } ; [package] => { $ crate :: JsSyntaxKind :: PACKAGE_KW } ; [private] => { $ crate :: JsSyntaxKind :: PRIVATE_KW } ; [protected] => { $ crate :: JsSyntaxKind :: PROTECTED_KW } ; [public] => { $ crate :: JsSyntaxKind :: PUBLIC_KW } ; [static] => { $ crate :: JsSyntaxKind :: STATIC_KW } ; [yield] => { $ crate :: JsSyntaxKind :: YIELD_KW } ; [abstract] => { $ crate :: JsSyntaxKind :: ABSTRACT_KW } ; [accessor] => { $ crate :: JsSyntaxKind :: ACCESSOR_KW } ; [as] => { $ crate :: JsSyntaxKind :: AS_KW } ; [satisfies] => { $ crate :: JsSyntaxKind :: SATISFIES_KW } ; [asserts] => { $ crate :: JsSyntaxKind :: ASSERTS_KW } ; [assert] => { $ crate :: JsSyntaxKind :: ASSERT_KW } ; [any] => { $ crate :: JsSyntaxKind :: ANY_KW } ; [async] => { $ crate :: JsSyntaxKind :: ASYNC_KW } ; [await] => { $ crate :: JsSyntaxKind :: AWAIT_KW } ; [boolean] => { $ crate :: JsSyntaxKind :: BOOLEAN_KW } ; [constructor] => { $ crate :: JsSyntaxKind :: CONSTRUCTOR_KW } ; [declare] => { $ crate :: JsSyntaxKind :: DECLARE_KW } ; [get] => { $ crate :: JsSyntaxKind :: GET_KW } ; [infer] => { $ crate :: JsSyntaxKind :: INFER_KW } ; [is] => { $ crate :: JsSyntaxKind :: IS_KW } ; [keyof] => { $ crate :: JsSyntaxKind :: KEYOF_KW } ; [module] => { $ crate :: JsSyntaxKind :: MODULE_KW } ; [namespace] => { $ crate :: JsSyntaxKind :: NAMESPACE_KW } ; [never] => { $ crate :: JsSyntaxKind :: NEVER_KW } ; [readonly] => { $ crate :: JsSyntaxKind :: READONLY_KW } ; [require] => { $ crate :: JsSyntaxKind :: REQUIRE_KW } ; [number] => { $ crate :: JsSyntaxKind :: NUMBER_KW } ; [object] => { $ crate :: JsSyntaxKind :: OBJECT_KW } ; [set] => { $ crate :: JsSyntaxKind :: SET_KW } ; [string] => { $ crate :: JsSyntaxKind :: STRING_KW } ; [symbol] => { $ crate :: JsSyntaxKind :: SYMBOL_KW } ; [type] => { $ crate :: JsSyntaxKind :: TYPE_KW } ; [undefined] => { $ crate :: JsSyntaxKind :: UNDEFINED_KW } ; [unique] => { $ crate :: JsSyntaxKind :: UNIQUE_KW } ; [unknown] => { $ crate :: JsSyntaxKind :: UNKNOWN_KW } ; [from] => { $ crate :: JsSyntaxKind :: FROM_KW } ; [global] => { $ crate :: JsSyntaxKind :: GLOBAL_KW } ; [bigint] => { $ crate :: JsSyntaxKind :: BIGINT_KW } ; [override] => { $ crate :: JsSyntaxKind :: OVERRIDE_KW } ; [of] => { $ crate :: JsSyntaxKind :: OF_KW } ; [out] => { $ crate :: JsSyntaxKind :: OUT_KW } ; [using] => { $ crate :: JsSyntaxKind :: USING_KW } ; [ident] => { $ crate :: JsSyntaxKind :: IDENT } ; [EOF] => { $ crate :: JsSyntaxKind :: EOF } ; [#] => { $ crate :: JsSyntaxKind :: HASH } ; } diff --git a/crates/rome_js_syntax/src/generated/nodes.rs b/crates/rome_js_syntax/src/generated/nodes.rs index 4b59deebc16..5d0a575cc28 100644 --- a/crates/rome_js_syntax/src/generated/nodes.rs +++ b/crates/rome_js_syntax/src/generated/nodes.rs @@ -2658,15 +2658,17 @@ impl JsForVariableDeclaration { pub const unsafe fn new_unchecked(syntax: SyntaxNode) -> Self { Self { syntax } } pub fn as_fields(&self) -> JsForVariableDeclarationFields { JsForVariableDeclarationFields { + await_token: self.await_token(), kind_token: self.kind_token(), declarator: self.declarator(), } } + pub fn await_token(&self) -> Option { support::token(&self.syntax, 0usize) } pub fn kind_token(&self) -> SyntaxResult { - support::required_token(&self.syntax, 0usize) + support::required_token(&self.syntax, 1usize) } pub fn declarator(&self) -> SyntaxResult { - support::required_node(&self.syntax, 1usize) + support::required_node(&self.syntax, 2usize) } } #[cfg(feature = "serde")] @@ -2680,6 +2682,7 @@ impl Serialize for JsForVariableDeclaration { } #[cfg_attr(feature = "serde", derive(Serialize))] pub struct JsForVariableDeclarationFields { + pub await_token: Option, pub kind_token: SyntaxResult, pub declarator: SyntaxResult, } @@ -6335,14 +6338,16 @@ impl JsVariableDeclaration { pub const unsafe fn new_unchecked(syntax: SyntaxNode) -> Self { Self { syntax } } pub fn as_fields(&self) -> JsVariableDeclarationFields { JsVariableDeclarationFields { + await_token: self.await_token(), kind: self.kind(), declarators: self.declarators(), } } + pub fn await_token(&self) -> Option { support::token(&self.syntax, 0usize) } pub fn kind(&self) -> SyntaxResult { - support::required_token(&self.syntax, 0usize) + support::required_token(&self.syntax, 1usize) } - pub fn declarators(&self) -> JsVariableDeclaratorList { support::list(&self.syntax, 1usize) } + pub fn declarators(&self) -> JsVariableDeclaratorList { support::list(&self.syntax, 2usize) } } #[cfg(feature = "serde")] impl Serialize for JsVariableDeclaration { @@ -6355,6 +6360,7 @@ impl Serialize for JsVariableDeclaration { } #[cfg_attr(feature = "serde", derive(Serialize))] pub struct JsVariableDeclarationFields { + pub await_token: Option, pub kind: SyntaxResult, pub declarators: JsVariableDeclaratorList, } @@ -17436,6 +17442,10 @@ impl AstNode for JsForVariableDeclaration { impl std::fmt::Debug for JsForVariableDeclaration { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.debug_struct("JsForVariableDeclaration") + .field( + "await_token", + &support::DebugOptionalElement(self.await_token()), + ) .field("kind_token", &support::DebugSyntaxResult(self.kind_token())) .field("declarator", &support::DebugSyntaxResult(self.declarator())) .finish() @@ -20383,6 +20393,10 @@ impl AstNode for JsVariableDeclaration { impl std::fmt::Debug for JsVariableDeclaration { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.debug_struct("JsVariableDeclaration") + .field( + "await_token", + &support::DebugOptionalElement(self.await_token()), + ) .field("kind", &support::DebugSyntaxResult(self.kind())) .field("declarators", &self.declarators()) .finish() diff --git a/crates/rome_js_syntax/src/generated/nodes_mut.rs b/crates/rome_js_syntax/src/generated/nodes_mut.rs index 94ab8e6644b..d56292eaef2 100644 --- a/crates/rome_js_syntax/src/generated/nodes_mut.rs +++ b/crates/rome_js_syntax/src/generated/nodes_mut.rs @@ -1385,16 +1385,22 @@ impl JsForStatement { } } impl JsForVariableDeclaration { + pub fn with_await_token(self, element: Option) -> Self { + Self::unwrap_cast( + self.syntax + .splice_slots(0usize..=0usize, once(element.map(|element| element.into()))), + ) + } pub fn with_kind_token_token(self, element: SyntaxToken) -> Self { Self::unwrap_cast( self.syntax - .splice_slots(0usize..=0usize, once(Some(element.into()))), + .splice_slots(1usize..=1usize, once(Some(element.into()))), ) } pub fn with_declarator(self, element: JsVariableDeclarator) -> Self { Self::unwrap_cast( self.syntax - .splice_slots(1usize..=1usize, once(Some(element.into_syntax().into()))), + .splice_slots(2usize..=2usize, once(Some(element.into_syntax().into()))), ) } } @@ -3203,16 +3209,22 @@ impl JsUnaryExpression { } } impl JsVariableDeclaration { + pub fn with_await_token(self, element: Option) -> Self { + Self::unwrap_cast( + self.syntax + .splice_slots(0usize..=0usize, once(element.map(|element| element.into()))), + ) + } pub fn with_kind_token(self, element: SyntaxToken) -> Self { Self::unwrap_cast( self.syntax - .splice_slots(0usize..=0usize, once(Some(element.into()))), + .splice_slots(1usize..=1usize, once(Some(element.into()))), ) } pub fn with_declarators(self, element: JsVariableDeclaratorList) -> Self { Self::unwrap_cast( self.syntax - .splice_slots(1usize..=1usize, once(Some(element.into_syntax().into()))), + .splice_slots(2usize..=2usize, once(Some(element.into_syntax().into()))), ) } } diff --git a/crates/rome_js_syntax/src/lib.rs b/crates/rome_js_syntax/src/lib.rs index f45ec01f7d3..63c703d7968 100644 --- a/crates/rome_js_syntax/src/lib.rs +++ b/crates/rome_js_syntax/src/lib.rs @@ -66,7 +66,7 @@ impl JsSyntaxKind { /// Returns `true` for any contextual (await) or non-contextual keyword #[inline] pub const fn is_keyword(self) -> bool { - (self as u16) <= (JsSyntaxKind::OUT_KW as u16) + (self as u16) <= (JsSyntaxKind::USING_KW as u16) && (self as u16) >= (JsSyntaxKind::BREAK_KW as u16) } @@ -74,7 +74,7 @@ impl JsSyntaxKind { #[inline] pub const fn is_contextual_keyword(self) -> bool { (self as u16) >= (JsSyntaxKind::ABSTRACT_KW as u16) - && (self as u16) <= (JsSyntaxKind::OUT_KW as u16) + && (self as u16) <= (JsSyntaxKind::USING_KW as u16) } /// Returns true for all non-contextual keywords (includes future reserved keywords) diff --git a/crates/rome_js_transform/src/transformers/ts_enum.rs b/crates/rome_js_transform/src/transformers/ts_enum.rs index e124b898261..fbb1533129a 100644 --- a/crates/rome_js_transform/src/transformers/ts_enum.rs +++ b/crates/rome_js_transform/src/transformers/ts_enum.rs @@ -91,10 +91,13 @@ fn make_variable(node: &TsEnumMembers) -> JsVariableStatement { .build(); let list = js_variable_declarator_list([binding], []); - js_variable_statement(js_variable_declaration( - token(T![var]).with_trailing_trivia([(TriviaPieceKind::Whitespace, " ")]), - list, - )) + js_variable_statement( + js_variable_declaration( + token(T![var]).with_trailing_trivia([(TriviaPieceKind::Whitespace, " ")]), + list, + ) + .build(), + ) .with_semicolon_token(token(T![;])) .build() } diff --git a/xtask/codegen/js.ungram b/xtask/codegen/js.ungram index f47cae1f506..3d0beafeb49 100644 --- a/xtask/codegen/js.ungram +++ b/xtask/codegen/js.ungram @@ -190,7 +190,8 @@ AnyJsForInOrOfInitializer = | JsForVariableDeclaration JsForVariableDeclaration = - kind_token: ('var' | 'let' | 'const') + 'await'? + kind_token: ('var' | 'let' | 'const' | 'using') declarator: JsVariableDeclarator JsBreakStatement = @@ -1182,8 +1183,9 @@ JsVariableStatement = // let a, b = c; // ^^^^^^^^ JsVariableDeclaration = - kind: ('var' | 'const' | 'let') - declarators: JsVariableDeclaratorList + 'await'? + kind: ('var' | 'const' | 'let' | 'using') + declarators: JsVariableDeclaratorList JsVariableDeclaratorList = (JsVariableDeclarator (',' JsVariableDeclarator)*) diff --git a/xtask/codegen/src/kinds_src.rs b/xtask/codegen/src/kinds_src.rs index eab1d74893c..ae2ddb135b8 100644 --- a/xtask/codegen/src/kinds_src.rs +++ b/xtask/codegen/src/kinds_src.rs @@ -163,6 +163,7 @@ pub const JS_KINDS_SRC: KindsSrc = KindsSrc { "override", "of", "out", + "using", ], literals: &[ "JS_NUMBER_LITERAL",