From 8a229d42a4b0b5e2d74430c4a28228c2279f7767 Mon Sep 17 00:00:00 2001 From: Victorien ELVINGER Date: Fri, 3 Feb 2023 10:57:09 +0100 Subject: [PATCH] refactor(js_ungram): normalize `BigInt` to `Bigint` (#4139) --- .../src/generated/node_factory.rs | 20 +-- .../src/generated/syntax_factory.rs | 16 +-- crates/rome_js_formatter/src/generated.rs | 48 +++---- .../src/js/any/literal_expression.rs | 2 +- ...ession.rs => bigint_literal_expression.rs} | 16 +-- .../src/js/expressions/mod.rs | 2 +- crates/rome_js_formatter/src/parentheses.rs | 8 +- .../rome_js_formatter/src/ts/any/ts_type.rs | 2 +- .../src/ts/lists/union_type_variant_list.rs | 6 +- ...literal_type.rs => bigint_literal_type.rs} | 14 +-- crates/rome_js_formatter/src/ts/types/mod.rs | 2 +- .../rome_js_formatter/src/utils/typescript.rs | 2 +- crates/rome_js_parser/src/syntax/expr.rs | 6 +- .../src/syntax/typescript/types.rs | 4 +- .../test_data/inline/err/literals.rast | 8 +- .../inline/ok/jsx_children_expression.rast | 8 +- .../test_data/inline/ok/literals.rast | 16 +-- .../ok/ts_instantiation_expressions_1.rast | 8 +- ...ts_instantiation_expressions_new_line.rast | 8 +- .../test_data/inline/ok/ts_literal_type.rast | 16 +-- crates/rome_js_syntax/src/expr_ext.rs | 2 +- crates/rome_js_syntax/src/generated/kind.rs | 8 +- crates/rome_js_syntax/src/generated/macros.rs | 8 +- crates/rome_js_syntax/src/generated/nodes.rs | 118 +++++++++--------- .../rome_js_syntax/src/generated/nodes_mut.rs | 4 +- crates/rome_js_unicode_table/src/tables.rs | 52 ++++---- rfcs/001-js-grammar.ungram | 2 +- xtask/codegen/js.ungram | 8 +- xtask/codegen/src/kinds_src.rs | 6 +- 29 files changed, 210 insertions(+), 210 deletions(-) rename crates/rome_js_formatter/src/js/expressions/{big_int_literal_expression.rs => bigint_literal_expression.rs} (71%) rename crates/rome_js_formatter/src/ts/types/{big_int_literal_type.rs => bigint_literal_type.rs} (74%) diff --git a/crates/rome_js_factory/src/generated/node_factory.rs b/crates/rome_js_factory/src/generated/node_factory.rs index 684f43af0b4..2665262f0fe 100644 --- a/crates/rome_js_factory/src/generated/node_factory.rs +++ b/crates/rome_js_factory/src/generated/node_factory.rs @@ -175,9 +175,9 @@ pub fn js_await_expression( ], )) } -pub fn js_big_int_literal_expression(value_token: SyntaxToken) -> JsBigIntLiteralExpression { - JsBigIntLiteralExpression::unwrap_cast(SyntaxNode::new_detached( - JsSyntaxKind::JS_BIG_INT_LITERAL_EXPRESSION, +pub fn js_bigint_literal_expression(value_token: SyntaxToken) -> JsBigintLiteralExpression { + JsBigintLiteralExpression::unwrap_cast(SyntaxNode::new_detached( + JsSyntaxKind::JS_BIGINT_LITERAL_EXPRESSION, [Some(SyntaxElement::Token(value_token))], )) } @@ -3950,24 +3950,24 @@ impl TsAssertsReturnTypeBuilder { )) } } -pub fn ts_big_int_literal_type(literal_token: SyntaxToken) -> TsBigIntLiteralTypeBuilder { - TsBigIntLiteralTypeBuilder { +pub fn ts_bigint_literal_type(literal_token: SyntaxToken) -> TsBigintLiteralTypeBuilder { + TsBigintLiteralTypeBuilder { literal_token, minus_token: None, } } -pub struct TsBigIntLiteralTypeBuilder { +pub struct TsBigintLiteralTypeBuilder { literal_token: SyntaxToken, minus_token: Option, } -impl TsBigIntLiteralTypeBuilder { +impl TsBigintLiteralTypeBuilder { pub fn with_minus_token(mut self, minus_token: SyntaxToken) -> Self { self.minus_token = Some(minus_token); self } - pub fn build(self) -> TsBigIntLiteralType { - TsBigIntLiteralType::unwrap_cast(SyntaxNode::new_detached( - JsSyntaxKind::TS_BIG_INT_LITERAL_TYPE, + pub fn build(self) -> TsBigintLiteralType { + TsBigintLiteralType::unwrap_cast(SyntaxNode::new_detached( + JsSyntaxKind::TS_BIGINT_LITERAL_TYPE, [ self.minus_token.map(|token| SyntaxElement::Token(token)), Some(SyntaxElement::Token(self.literal_token)), diff --git a/crates/rome_js_factory/src/generated/syntax_factory.rs b/crates/rome_js_factory/src/generated/syntax_factory.rs index bcdc97cc87b..7c870860a65 100644 --- a/crates/rome_js_factory/src/generated/syntax_factory.rs +++ b/crates/rome_js_factory/src/generated/syntax_factory.rs @@ -368,12 +368,12 @@ impl SyntaxFactory for JsSyntaxFactory { } slots.into_node(JS_AWAIT_EXPRESSION, children) } - JS_BIG_INT_LITERAL_EXPRESSION => { + JS_BIGINT_LITERAL_EXPRESSION => { let mut elements = (&children).into_iter(); let mut slots: RawNodeSlots<1usize> = RawNodeSlots::default(); let mut current_element = elements.next(); if let Some(element) = ¤t_element { - if element.kind() == JS_BIG_INT_LITERAL { + if element.kind() == JS_BIGINT_LITERAL { slots.mark_present(); current_element = elements.next(); } @@ -381,11 +381,11 @@ impl SyntaxFactory for JsSyntaxFactory { slots.next_slot(); if current_element.is_some() { return RawSyntaxNode::new( - JS_BIG_INT_LITERAL_EXPRESSION.to_bogus(), + JS_BIGINT_LITERAL_EXPRESSION.to_bogus(), children.into_iter().map(Some), ); } - slots.into_node(JS_BIG_INT_LITERAL_EXPRESSION, children) + slots.into_node(JS_BIGINT_LITERAL_EXPRESSION, children) } JS_BINARY_EXPRESSION => { let mut elements = (&children).into_iter(); @@ -6187,7 +6187,7 @@ impl SyntaxFactory for JsSyntaxFactory { } slots.into_node(TS_ASSERTS_RETURN_TYPE, children) } - TS_BIG_INT_LITERAL_TYPE => { + TS_BIGINT_LITERAL_TYPE => { let mut elements = (&children).into_iter(); let mut slots: RawNodeSlots<2usize> = RawNodeSlots::default(); let mut current_element = elements.next(); @@ -6199,7 +6199,7 @@ impl SyntaxFactory for JsSyntaxFactory { } slots.next_slot(); if let Some(element) = ¤t_element { - if element.kind() == JS_BIG_INT_LITERAL { + if element.kind() == JS_BIGINT_LITERAL { slots.mark_present(); current_element = elements.next(); } @@ -6207,11 +6207,11 @@ impl SyntaxFactory for JsSyntaxFactory { slots.next_slot(); if current_element.is_some() { return RawSyntaxNode::new( - TS_BIG_INT_LITERAL_TYPE.to_bogus(), + TS_BIGINT_LITERAL_TYPE.to_bogus(), children.into_iter().map(Some), ); } - slots.into_node(TS_BIG_INT_LITERAL_TYPE, children) + slots.into_node(TS_BIGINT_LITERAL_TYPE, children) } TS_BIGINT_TYPE => { let mut elements = (&children).into_iter(); diff --git a/crates/rome_js_formatter/src/generated.rs b/crates/rome_js_formatter/src/generated.rs index 7e198b83ccd..4ac106fc095 100644 --- a/crates/rome_js_formatter/src/generated.rs +++ b/crates/rome_js_formatter/src/generated.rs @@ -5426,36 +5426,36 @@ impl IntoFormat for rome_js_syntax::JsNumberLiteralExpression { FormatOwnedWithRule :: new (self , crate :: js :: expressions :: number_literal_expression :: FormatJsNumberLiteralExpression :: default ()) } } -impl FormatRule - for crate::js::expressions::big_int_literal_expression::FormatJsBigIntLiteralExpression +impl FormatRule + for crate::js::expressions::bigint_literal_expression::FormatJsBigintLiteralExpression { type Context = JsFormatContext; #[inline(always)] fn fmt( &self, - node: &rome_js_syntax::JsBigIntLiteralExpression, + node: &rome_js_syntax::JsBigintLiteralExpression, f: &mut JsFormatter, ) -> FormatResult<()> { - FormatNodeRule::::fmt(self, node, f) + FormatNodeRule::::fmt(self, node, f) } } -impl AsFormat for rome_js_syntax::JsBigIntLiteralExpression { +impl AsFormat for rome_js_syntax::JsBigintLiteralExpression { type Format<'a> = FormatRefWithRule< 'a, - rome_js_syntax::JsBigIntLiteralExpression, - crate::js::expressions::big_int_literal_expression::FormatJsBigIntLiteralExpression, + rome_js_syntax::JsBigintLiteralExpression, + crate::js::expressions::bigint_literal_expression::FormatJsBigintLiteralExpression, >; fn format(&self) -> Self::Format<'_> { - FormatRefWithRule :: new (self , crate :: js :: expressions :: big_int_literal_expression :: FormatJsBigIntLiteralExpression :: default ()) + FormatRefWithRule :: new (self , crate :: js :: expressions :: bigint_literal_expression :: FormatJsBigintLiteralExpression :: default ()) } } -impl IntoFormat for rome_js_syntax::JsBigIntLiteralExpression { +impl IntoFormat for rome_js_syntax::JsBigintLiteralExpression { type Format = FormatOwnedWithRule< - rome_js_syntax::JsBigIntLiteralExpression, - crate::js::expressions::big_int_literal_expression::FormatJsBigIntLiteralExpression, + rome_js_syntax::JsBigintLiteralExpression, + crate::js::expressions::bigint_literal_expression::FormatJsBigintLiteralExpression, >; fn into_format(self) -> Self::Format { - FormatOwnedWithRule :: new (self , crate :: js :: expressions :: big_int_literal_expression :: FormatJsBigIntLiteralExpression :: default ()) + FormatOwnedWithRule :: new (self , crate :: js :: expressions :: bigint_literal_expression :: FormatJsBigintLiteralExpression :: default ()) } } impl FormatRule @@ -7474,41 +7474,41 @@ impl IntoFormat for rome_js_syntax::TsNumberLiteralType { ) } } -impl FormatRule - for crate::ts::types::big_int_literal_type::FormatTsBigIntLiteralType +impl FormatRule + for crate::ts::types::bigint_literal_type::FormatTsBigintLiteralType { type Context = JsFormatContext; #[inline(always)] fn fmt( &self, - node: &rome_js_syntax::TsBigIntLiteralType, + node: &rome_js_syntax::TsBigintLiteralType, f: &mut JsFormatter, ) -> FormatResult<()> { - FormatNodeRule::::fmt(self, node, f) + FormatNodeRule::::fmt(self, node, f) } } -impl AsFormat for rome_js_syntax::TsBigIntLiteralType { +impl AsFormat for rome_js_syntax::TsBigintLiteralType { type Format<'a> = FormatRefWithRule< 'a, - rome_js_syntax::TsBigIntLiteralType, - crate::ts::types::big_int_literal_type::FormatTsBigIntLiteralType, + rome_js_syntax::TsBigintLiteralType, + crate::ts::types::bigint_literal_type::FormatTsBigintLiteralType, >; fn format(&self) -> Self::Format<'_> { FormatRefWithRule::new( self, - crate::ts::types::big_int_literal_type::FormatTsBigIntLiteralType::default(), + crate::ts::types::bigint_literal_type::FormatTsBigintLiteralType::default(), ) } } -impl IntoFormat for rome_js_syntax::TsBigIntLiteralType { +impl IntoFormat for rome_js_syntax::TsBigintLiteralType { type Format = FormatOwnedWithRule< - rome_js_syntax::TsBigIntLiteralType, - crate::ts::types::big_int_literal_type::FormatTsBigIntLiteralType, + rome_js_syntax::TsBigintLiteralType, + crate::ts::types::bigint_literal_type::FormatTsBigintLiteralType, >; fn into_format(self) -> Self::Format { FormatOwnedWithRule::new( self, - crate::ts::types::big_int_literal_type::FormatTsBigIntLiteralType::default(), + crate::ts::types::bigint_literal_type::FormatTsBigintLiteralType::default(), ) } } diff --git a/crates/rome_js_formatter/src/js/any/literal_expression.rs b/crates/rome_js_formatter/src/js/any/literal_expression.rs index b2a96db0656..8e3fa5d93e6 100644 --- a/crates/rome_js_formatter/src/js/any/literal_expression.rs +++ b/crates/rome_js_formatter/src/js/any/literal_expression.rs @@ -10,7 +10,7 @@ impl FormatRule for FormatAnyJsLiteralExpression { match node { AnyJsLiteralExpression::JsStringLiteralExpression(node) => node.format().fmt(f), AnyJsLiteralExpression::JsNumberLiteralExpression(node) => node.format().fmt(f), - AnyJsLiteralExpression::JsBigIntLiteralExpression(node) => node.format().fmt(f), + AnyJsLiteralExpression::JsBigintLiteralExpression(node) => node.format().fmt(f), AnyJsLiteralExpression::JsBooleanLiteralExpression(node) => node.format().fmt(f), AnyJsLiteralExpression::JsNullLiteralExpression(node) => node.format().fmt(f), AnyJsLiteralExpression::JsRegexLiteralExpression(node) => node.format().fmt(f), diff --git a/crates/rome_js_formatter/src/js/expressions/big_int_literal_expression.rs b/crates/rome_js_formatter/src/js/expressions/bigint_literal_expression.rs similarity index 71% rename from crates/rome_js_formatter/src/js/expressions/big_int_literal_expression.rs rename to crates/rome_js_formatter/src/js/expressions/bigint_literal_expression.rs index 45cb5e26e28..9f981732cb6 100644 --- a/crates/rome_js_formatter/src/js/expressions/big_int_literal_expression.rs +++ b/crates/rome_js_formatter/src/js/expressions/bigint_literal_expression.rs @@ -5,19 +5,19 @@ use std::borrow::Cow; use crate::prelude::*; use crate::parentheses::NeedsParentheses; -use rome_js_syntax::JsBigIntLiteralExpressionFields; -use rome_js_syntax::{JsBigIntLiteralExpression, JsSyntaxNode}; +use rome_js_syntax::JsBigintLiteralExpressionFields; +use rome_js_syntax::{JsBigintLiteralExpression, JsSyntaxNode}; #[derive(Debug, Clone, Default)] -pub(crate) struct FormatJsBigIntLiteralExpression; +pub(crate) struct FormatJsBigintLiteralExpression; -impl FormatNodeRule for FormatJsBigIntLiteralExpression { +impl FormatNodeRule for FormatJsBigintLiteralExpression { fn fmt_fields( &self, - node: &JsBigIntLiteralExpression, + node: &JsBigintLiteralExpression, f: &mut JsFormatter, ) -> FormatResult<()> { - let JsBigIntLiteralExpressionFields { value_token } = node.as_fields(); + let JsBigintLiteralExpressionFields { value_token } = node.as_fields(); let value_token = value_token?; let original = value_token.text_trimmed(); @@ -35,12 +35,12 @@ impl FormatNodeRule for FormatJsBigIntLiteralExpressi } } - fn needs_parentheses(&self, item: &JsBigIntLiteralExpression) -> bool { + fn needs_parentheses(&self, item: &JsBigintLiteralExpression) -> bool { item.needs_parentheses() } } -impl NeedsParentheses for JsBigIntLiteralExpression { +impl NeedsParentheses for JsBigintLiteralExpression { #[inline(always)] fn needs_parentheses(&self) -> bool { false diff --git a/crates/rome_js_formatter/src/js/expressions/mod.rs b/crates/rome_js_formatter/src/js/expressions/mod.rs index ff948e64e3c..dbdb72576f4 100644 --- a/crates/rome_js_formatter/src/js/expressions/mod.rs +++ b/crates/rome_js_formatter/src/js/expressions/mod.rs @@ -4,7 +4,7 @@ pub(crate) mod array_expression; pub(crate) mod arrow_function_expression; pub(crate) mod assignment_expression; pub(crate) mod await_expression; -pub(crate) mod big_int_literal_expression; +pub(crate) mod bigint_literal_expression; pub(crate) mod binary_expression; pub(crate) mod boolean_literal_expression; pub(crate) mod call_arguments; diff --git a/crates/rome_js_formatter/src/parentheses.rs b/crates/rome_js_formatter/src/parentheses.rs index e8c7e469e3d..bb11a42151a 100644 --- a/crates/rome_js_formatter/src/parentheses.rs +++ b/crates/rome_js_formatter/src/parentheses.rs @@ -69,7 +69,7 @@ impl NeedsParentheses for AnyJsLiteralExpression { #[inline] fn needs_parentheses(&self) -> bool { match self { - AnyJsLiteralExpression::JsBigIntLiteralExpression(big_int) => { + AnyJsLiteralExpression::JsBigintLiteralExpression(big_int) => { big_int.needs_parentheses() } AnyJsLiteralExpression::JsBooleanLiteralExpression(boolean) => { @@ -89,7 +89,7 @@ impl NeedsParentheses for AnyJsLiteralExpression { #[inline] fn needs_parentheses_with_parent(&self, parent: &JsSyntaxNode) -> bool { match self { - AnyJsLiteralExpression::JsBigIntLiteralExpression(big_int) => { + AnyJsLiteralExpression::JsBigintLiteralExpression(big_int) => { big_int.needs_parentheses_with_parent(parent) } AnyJsLiteralExpression::JsBooleanLiteralExpression(boolean) => { @@ -945,7 +945,7 @@ impl NeedsParentheses for AnyTsType { match self { AnyTsType::TsAnyType(ty) => ty.needs_parentheses(), AnyTsType::TsArrayType(ty) => ty.needs_parentheses(), - AnyTsType::TsBigIntLiteralType(ty) => ty.needs_parentheses(), + AnyTsType::TsBigintLiteralType(ty) => ty.needs_parentheses(), AnyTsType::TsBigintType(ty) => ty.needs_parentheses(), AnyTsType::TsBooleanLiteralType(ty) => ty.needs_parentheses(), AnyTsType::TsBooleanType(ty) => ty.needs_parentheses(), @@ -985,7 +985,7 @@ impl NeedsParentheses for AnyTsType { match self { AnyTsType::TsAnyType(ty) => ty.needs_parentheses_with_parent(parent), AnyTsType::TsArrayType(ty) => ty.needs_parentheses_with_parent(parent), - AnyTsType::TsBigIntLiteralType(ty) => ty.needs_parentheses_with_parent(parent), + AnyTsType::TsBigintLiteralType(ty) => ty.needs_parentheses_with_parent(parent), AnyTsType::TsBigintType(ty) => ty.needs_parentheses_with_parent(parent), AnyTsType::TsBooleanLiteralType(ty) => ty.needs_parentheses_with_parent(parent), AnyTsType::TsBooleanType(ty) => ty.needs_parentheses_with_parent(parent), diff --git a/crates/rome_js_formatter/src/ts/any/ts_type.rs b/crates/rome_js_formatter/src/ts/any/ts_type.rs index 43618709b05..88a43076d2b 100644 --- a/crates/rome_js_formatter/src/ts/any/ts_type.rs +++ b/crates/rome_js_formatter/src/ts/any/ts_type.rs @@ -31,7 +31,7 @@ impl FormatRule for FormatAnyTsType { AnyTsType::TsNonPrimitiveType(node) => node.format().fmt(f), AnyTsType::TsThisType(node) => node.format().fmt(f), AnyTsType::TsNumberLiteralType(node) => node.format().fmt(f), - AnyTsType::TsBigIntLiteralType(node) => node.format().fmt(f), + AnyTsType::TsBigintLiteralType(node) => node.format().fmt(f), AnyTsType::TsStringLiteralType(node) => node.format().fmt(f), AnyTsType::TsNullLiteralType(node) => node.format().fmt(f), AnyTsType::TsBooleanLiteralType(node) => node.format().fmt(f), diff --git a/crates/rome_js_formatter/src/ts/lists/union_type_variant_list.rs b/crates/rome_js_formatter/src/ts/lists/union_type_variant_list.rs index a2c8be0b3f5..57610c8215f 100644 --- a/crates/rome_js_formatter/src/ts/lists/union_type_variant_list.rs +++ b/crates/rome_js_formatter/src/ts/lists/union_type_variant_list.rs @@ -3,7 +3,7 @@ use crate::ts::bogus::bogus_type::FormatTsBogusType; use crate::ts::module::import_type::FormatTsImportType; use crate::ts::types::any_type::FormatTsAnyType; use crate::ts::types::array_type::FormatTsArrayType; -use crate::ts::types::big_int_literal_type::FormatTsBigIntLiteralType; +use crate::ts::types::bigint_literal_type::FormatTsBigintLiteralType; use crate::ts::types::bigint_type::FormatTsBigintType; use crate::ts::types::boolean_literal_type::FormatTsBooleanLiteralType; use crate::ts::types::boolean_type::FormatTsBooleanType; @@ -97,8 +97,8 @@ impl Format for FormatTypeVariant<'_> { match node { AnyTsType::TsAnyType(ty) => FormatTsAnyType::default().fmt_node(ty, f), AnyTsType::TsArrayType(ty) => FormatTsArrayType::default().fmt_node(ty, f), - AnyTsType::TsBigIntLiteralType(ty) => { - FormatTsBigIntLiteralType::default().fmt_node(ty, f) + AnyTsType::TsBigintLiteralType(ty) => { + FormatTsBigintLiteralType::default().fmt_node(ty, f) } AnyTsType::TsBigintType(ty) => FormatTsBigintType::default().fmt_node(ty, f), AnyTsType::TsBooleanLiteralType(ty) => { diff --git a/crates/rome_js_formatter/src/ts/types/big_int_literal_type.rs b/crates/rome_js_formatter/src/ts/types/bigint_literal_type.rs similarity index 74% rename from crates/rome_js_formatter/src/ts/types/big_int_literal_type.rs rename to crates/rome_js_formatter/src/ts/types/bigint_literal_type.rs index cece54e079d..a1ee02877a9 100644 --- a/crates/rome_js_formatter/src/ts/types/big_int_literal_type.rs +++ b/crates/rome_js_formatter/src/ts/types/bigint_literal_type.rs @@ -5,14 +5,14 @@ use crate::prelude::*; use crate::parentheses::NeedsParentheses; use rome_formatter::token::string::ToAsciiLowercaseCow; use rome_formatter::write; -use rome_js_syntax::{JsSyntaxNode, TsBigIntLiteralType, TsBigIntLiteralTypeFields}; +use rome_js_syntax::{JsSyntaxNode, TsBigintLiteralType, TsBigintLiteralTypeFields}; #[derive(Debug, Clone, Default)] -pub struct FormatTsBigIntLiteralType; +pub struct FormatTsBigintLiteralType; -impl FormatNodeRule for FormatTsBigIntLiteralType { - fn fmt_fields(&self, node: &TsBigIntLiteralType, f: &mut JsFormatter) -> FormatResult<()> { - let TsBigIntLiteralTypeFields { +impl FormatNodeRule for FormatTsBigintLiteralType { + fn fmt_fields(&self, node: &TsBigintLiteralType, f: &mut JsFormatter) -> FormatResult<()> { + let TsBigintLiteralTypeFields { minus_token, literal_token, } = node.as_fields(); @@ -34,12 +34,12 @@ impl FormatNodeRule for FormatTsBigIntLiteralType { } } - fn needs_parentheses(&self, item: &TsBigIntLiteralType) -> bool { + fn needs_parentheses(&self, item: &TsBigintLiteralType) -> bool { item.needs_parentheses() } } -impl NeedsParentheses for TsBigIntLiteralType { +impl NeedsParentheses for TsBigintLiteralType { fn needs_parentheses_with_parent(&self, _parent: &JsSyntaxNode) -> bool { false } diff --git a/crates/rome_js_formatter/src/ts/types/mod.rs b/crates/rome_js_formatter/src/ts/types/mod.rs index 7e8525fb7ec..6e7effde807 100644 --- a/crates/rome_js_formatter/src/ts/types/mod.rs +++ b/crates/rome_js_formatter/src/ts/types/mod.rs @@ -3,7 +3,7 @@ pub(crate) mod any_type; pub(crate) mod array_type; pub(crate) mod asserts_return_type; -pub(crate) mod big_int_literal_type; +pub(crate) mod bigint_literal_type; pub(crate) mod bigint_type; pub(crate) mod boolean_literal_type; pub(crate) mod boolean_type; diff --git a/crates/rome_js_formatter/src/utils/typescript.rs b/crates/rome_js_formatter/src/utils/typescript.rs index 2852834b583..dc6ed5d2efc 100644 --- a/crates/rome_js_formatter/src/utils/typescript.rs +++ b/crates/rome_js_formatter/src/utils/typescript.rs @@ -31,7 +31,7 @@ pub(crate) fn is_simple_type(ty: &AnyTsType) -> bool { | AnyTsType::TsBooleanType(_) | AnyTsType::TsBooleanLiteralType(_) | AnyTsType::TsBigintType(_) - | AnyTsType::TsBigIntLiteralType(_) + | AnyTsType::TsBigintLiteralType(_) | AnyTsType::TsStringType(_) | AnyTsType::TsStringLiteralType(_) | AnyTsType::TsSymbolType(_) diff --git a/crates/rome_js_parser/src/syntax/expr.rs b/crates/rome_js_parser/src/syntax/expr.rs index 33381bd099a..254cc86e918 100644 --- a/crates/rome_js_parser/src/syntax/expr.rs +++ b/crates/rome_js_parser/src/syntax/expr.rs @@ -192,8 +192,8 @@ pub(crate) fn parse_big_int_literal_expression(p: &mut JsParser) -> ParsedSyntax } let m = p.start(); - p.bump_remap(JsSyntaxKind::JS_BIG_INT_LITERAL); - Present(m.complete(p, JS_BIG_INT_LITERAL_EXPRESSION)) + p.bump_remap(JsSyntaxKind::JS_BIGINT_LITERAL); + Present(m.complete(p, JS_BIGINT_LITERAL_EXPRESSION)) } pub(crate) fn parse_number_literal_expression(p: &mut JsParser) -> ParsedSyntax { @@ -1260,7 +1260,7 @@ pub(crate) fn is_nth_at_expression(p: &mut JsParser, n: usize) -> bool { | TRUE_KW | FALSE_KW | JS_NUMBER_LITERAL - | JS_BIG_INT_LITERAL + | JS_BIGINT_LITERAL | JS_STRING_LITERAL | NULL_KW => true, t => t.is_contextual_keyword() || t.is_future_reserved_keyword(), diff --git a/crates/rome_js_parser/src/syntax/typescript/types.rs b/crates/rome_js_parser/src/syntax/typescript/types.rs index e8b79d9932a..b51ea0d7c93 100644 --- a/crates/rome_js_parser/src/syntax/typescript/types.rs +++ b/crates/rome_js_parser/src/syntax/typescript/types.rs @@ -1098,7 +1098,7 @@ fn parse_ts_literal_type(p: &mut JsParser) -> ParsedSyntax { let type_kind = match number_expr.kind(p) { JS_NUMBER_LITERAL_EXPRESSION => TS_NUMBER_LITERAL_TYPE, - JS_BIG_INT_LITERAL_EXPRESSION => TS_BIG_INT_LITERAL_TYPE, + JS_BIGINT_LITERAL_EXPRESSION => TS_BIGINT_LITERAL_TYPE, _ => unreachable!(), }; @@ -1111,7 +1111,7 @@ fn parse_ts_literal_type(p: &mut JsParser) -> ParsedSyntax { parse_literal_expression(p).map(|mut expression| { let type_kind = match expression.kind(p) { JS_NUMBER_LITERAL_EXPRESSION => TS_NUMBER_LITERAL_TYPE, - JS_BIG_INT_LITERAL_EXPRESSION => TS_BIG_INT_LITERAL_TYPE, + JS_BIGINT_LITERAL_EXPRESSION => TS_BIGINT_LITERAL_TYPE, JS_NULL_LITERAL_EXPRESSION => TS_NULL_LITERAL_TYPE, JS_BOOLEAN_LITERAL_EXPRESSION => TS_BOOLEAN_LITERAL_TYPE, JS_STRING_LITERAL_EXPRESSION => TS_STRING_LITERAL_TYPE, diff --git a/crates/rome_js_parser/test_data/inline/err/literals.rast b/crates/rome_js_parser/test_data/inline/err/literals.rast index db51b1eb2eb..b71c0626a18 100644 --- a/crates/rome_js_parser/test_data/inline/err/literals.rast +++ b/crates/rome_js_parser/test_data/inline/err/literals.rast @@ -35,8 +35,8 @@ JsModule { JsExpressionStatement { expression: JsSequenceExpression { left: JsSequenceExpression { - left: JsBigIntLiteralExpression { - value_token: JS_BIG_INT_LITERAL@39..43 "01n" [Newline("\n")] [], + left: JsBigintLiteralExpression { + value_token: JS_BIGINT_LITERAL@39..43 "01n" [Newline("\n")] [], }, comma_token: COMMA@43..45 "," [] [Whitespace(" ")], right: JsNumberLiteralExpression { @@ -88,8 +88,8 @@ JsModule { 1: JS_EXPRESSION_STATEMENT@39..70 0: JS_SEQUENCE_EXPRESSION@39..70 0: JS_SEQUENCE_EXPRESSION@39..48 - 0: JS_BIG_INT_LITERAL_EXPRESSION@39..43 - 0: JS_BIG_INT_LITERAL@39..43 "01n" [Newline("\n")] [] + 0: JS_BIGINT_LITERAL_EXPRESSION@39..43 + 0: JS_BIGINT_LITERAL@39..43 "01n" [Newline("\n")] [] 1: COMMA@43..45 "," [] [Whitespace(" ")] 2: JS_NUMBER_LITERAL_EXPRESSION@45..48 0: JS_NUMBER_LITERAL@45..48 "0_0" [] [] 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 8f950736abe..6afca686259 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 @@ -124,8 +124,8 @@ JsModule { }, JsxExpressionChild { l_curly_token: L_CURLY@62..63 "{" [] [], - expression: JsBigIntLiteralExpression { - value_token: JS_BIG_INT_LITERAL@63..80 "9007199254740991n" [] [], + expression: JsBigintLiteralExpression { + value_token: JS_BIGINT_LITERAL@63..80 "9007199254740991n" [] [], }, r_curly_token: R_CURLY@80..81 "}" [] [], }, @@ -970,8 +970,8 @@ JsModule { 0: JSX_TEXT_LITERAL@59..62 "\n " [] [] 3: JSX_EXPRESSION_CHILD@62..81 0: L_CURLY@62..63 "{" [] [] - 1: JS_BIG_INT_LITERAL_EXPRESSION@63..80 - 0: JS_BIG_INT_LITERAL@63..80 "9007199254740991n" [] [] + 1: JS_BIGINT_LITERAL_EXPRESSION@63..80 + 0: JS_BIGINT_LITERAL@63..80 "9007199254740991n" [] [] 2: R_CURLY@80..81 "}" [] [] 4: JSX_TEXT@81..84 0: JSX_TEXT_LITERAL@81..84 "\n " [] [] diff --git a/crates/rome_js_parser/test_data/inline/ok/literals.rast b/crates/rome_js_parser/test_data/inline/ok/literals.rast index 82033bb1412..06fb9e42e9b 100644 --- a/crates/rome_js_parser/test_data/inline/ok/literals.rast +++ b/crates/rome_js_parser/test_data/inline/ok/literals.rast @@ -21,8 +21,8 @@ JsModule { semicolon_token: missing (optional), }, JsExpressionStatement { - expression: JsBigIntLiteralExpression { - value_token: JS_BIG_INT_LITERAL@12..15 "5n" [Newline("\n")] [], + expression: JsBigintLiteralExpression { + value_token: JS_BIGINT_LITERAL@12..15 "5n" [Newline("\n")] [], }, semicolon_token: missing (optional), }, @@ -57,8 +57,8 @@ JsModule { }, }, comma_token: COMMA@39..41 "," [] [Whitespace(" ")], - right: JsBigIntLiteralExpression { - value_token: JS_BIG_INT_LITERAL@41..43 "0n" [] [], + right: JsBigintLiteralExpression { + value_token: JS_BIGINT_LITERAL@41..43 "0n" [] [], }, }, comma_token: COMMA@43..45 "," [] [Whitespace(" ")], @@ -101,8 +101,8 @@ JsModule { 0: FALSE_KW@6..12 "false" [Newline("\n")] [] 1: (empty) 3: JS_EXPRESSION_STATEMENT@12..15 - 0: JS_BIG_INT_LITERAL_EXPRESSION@12..15 - 0: JS_BIG_INT_LITERAL@12..15 "5n" [Newline("\n")] [] + 0: JS_BIGINT_LITERAL_EXPRESSION@12..15 + 0: JS_BIGINT_LITERAL@12..15 "5n" [Newline("\n")] [] 1: (empty) 4: JS_EXPRESSION_STATEMENT@15..21 0: JS_STRING_LITERAL_EXPRESSION@15..21 @@ -126,8 +126,8 @@ JsModule { 2: JS_NUMBER_LITERAL_EXPRESSION@36..39 0: JS_NUMBER_LITERAL@36..39 "0.0" [] [] 1: COMMA@39..41 "," [] [Whitespace(" ")] - 2: JS_BIG_INT_LITERAL_EXPRESSION@41..43 - 0: JS_BIG_INT_LITERAL@41..43 "0n" [] [] + 2: JS_BIGINT_LITERAL_EXPRESSION@41..43 + 0: JS_BIGINT_LITERAL@41..43 "0n" [] [] 1: COMMA@43..45 "," [] [Whitespace(" ")] 2: JS_NUMBER_LITERAL_EXPRESSION@45..49 0: JS_NUMBER_LITERAL@45..49 "0e00" [] [] diff --git a/crates/rome_js_parser/test_data/inline/ok/ts_instantiation_expressions_1.rast b/crates/rome_js_parser/test_data/inline/ok/ts_instantiation_expressions_1.rast index f20566f7e2e..b30f9e31803 100644 --- a/crates/rome_js_parser/test_data/inline/ok/ts_instantiation_expressions_1.rast +++ b/crates/rome_js_parser/test_data/inline/ok/ts_instantiation_expressions_1.rast @@ -1028,8 +1028,8 @@ JsModule { }, }, operator_token: R_ANGLE@442..444 ">" [] [Whitespace(" ")], - right: JsBigIntLiteralExpression { - value_token: JS_BIG_INT_LITERAL@444..448 "123n" [] [], + right: JsBigintLiteralExpression { + value_token: JS_BIGINT_LITERAL@444..448 "123n" [] [], }, }, semicolon_token: SEMICOLON@448..449 ";" [] [], @@ -2277,8 +2277,8 @@ JsModule { 0: JS_REFERENCE_IDENTIFIER@440..442 0: IDENT@440..442 "T" [] [Whitespace(" ")] 1: R_ANGLE@442..444 ">" [] [Whitespace(" ")] - 2: JS_BIG_INT_LITERAL_EXPRESSION@444..448 - 0: JS_BIG_INT_LITERAL@444..448 "123n" [] [] + 2: JS_BIGINT_LITERAL_EXPRESSION@444..448 + 0: JS_BIGINT_LITERAL@444..448 "123n" [] [] 1: SEMICOLON@448..449 ";" [] [] 30: JS_EXPRESSION_STATEMENT@449..461 0: JS_BINARY_EXPRESSION@449..460 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 cf669b6ca79..422e636c432 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 @@ -1019,8 +1019,8 @@ JsModule { semicolon_token: missing (optional), }, JsExpressionStatement { - expression: JsBigIntLiteralExpression { - value_token: JS_BIG_INT_LITERAL@413..418 "123n" [Newline("\n")] [], + expression: JsBigintLiteralExpression { + value_token: JS_BIGINT_LITERAL@413..418 "123n" [Newline("\n")] [], }, semicolon_token: SEMICOLON@418..419 ";" [] [], }, @@ -2253,8 +2253,8 @@ JsModule { 2: R_ANGLE@412..413 ">" [] [] 1: (empty) 32: JS_EXPRESSION_STATEMENT@413..419 - 0: JS_BIG_INT_LITERAL_EXPRESSION@413..418 - 0: JS_BIG_INT_LITERAL@413..418 "123n" [Newline("\n")] [] + 0: JS_BIGINT_LITERAL_EXPRESSION@413..418 + 0: JS_BIGINT_LITERAL@413..418 "123n" [Newline("\n")] [] 1: SEMICOLON@418..419 ";" [] [] 33: JS_EXPRESSION_STATEMENT@419..425 0: TS_INSTANTIATION_EXPRESSION@419..425 diff --git a/crates/rome_js_parser/test_data/inline/ok/ts_literal_type.rast b/crates/rome_js_parser/test_data/inline/ok/ts_literal_type.rast index b8f2903b582..26162bcb4aa 100644 --- a/crates/rome_js_parser/test_data/inline/ok/ts_literal_type.rast +++ b/crates/rome_js_parser/test_data/inline/ok/ts_literal_type.rast @@ -35,9 +35,9 @@ JsModule { }, type_parameters: missing (optional), eq_token: EQ@32..34 "=" [] [Whitespace(" ")], - ty: TsBigIntLiteralType { + ty: TsBigintLiteralType { minus_token: missing (optional), - literal_token: JS_BIG_INT_LITERAL@34..36 "5n" [] [], + literal_token: JS_BIGINT_LITERAL@34..36 "5n" [] [], }, semicolon_token: SEMICOLON@36..37 ";" [] [], }, @@ -48,9 +48,9 @@ JsModule { }, type_parameters: missing (optional), eq_token: EQ@45..47 "=" [] [Whitespace(" ")], - ty: TsBigIntLiteralType { + ty: TsBigintLiteralType { minus_token: MINUS@47..48 "-" [] [], - literal_token: JS_BIG_INT_LITERAL@48..50 "5n" [] [], + literal_token: JS_BIGINT_LITERAL@48..50 "5n" [] [], }, semicolon_token: SEMICOLON@50..51 ";" [] [], }, @@ -136,9 +136,9 @@ JsModule { 0: IDENT@30..32 "C" [] [Whitespace(" ")] 2: (empty) 3: EQ@32..34 "=" [] [Whitespace(" ")] - 4: TS_BIG_INT_LITERAL_TYPE@34..36 + 4: TS_BIGINT_LITERAL_TYPE@34..36 0: (empty) - 1: JS_BIG_INT_LITERAL@34..36 "5n" [] [] + 1: JS_BIGINT_LITERAL@34..36 "5n" [] [] 5: SEMICOLON@36..37 ";" [] [] 3: TS_TYPE_ALIAS_DECLARATION@37..51 0: TYPE_KW@37..43 "type" [Newline("\n")] [Whitespace(" ")] @@ -146,9 +146,9 @@ JsModule { 0: IDENT@43..45 "D" [] [Whitespace(" ")] 2: (empty) 3: EQ@45..47 "=" [] [Whitespace(" ")] - 4: TS_BIG_INT_LITERAL_TYPE@47..50 + 4: TS_BIGINT_LITERAL_TYPE@47..50 0: MINUS@47..48 "-" [] [] - 1: JS_BIG_INT_LITERAL@48..50 "5n" [] [] + 1: JS_BIGINT_LITERAL@48..50 "5n" [] [] 5: SEMICOLON@50..51 ";" [] [] 4: TS_TYPE_ALIAS_DECLARATION@51..69 0: TYPE_KW@51..57 "type" [Newline("\n")] [Whitespace(" ")] diff --git a/crates/rome_js_syntax/src/expr_ext.rs b/crates/rome_js_syntax/src/expr_ext.rs index 65ad9ff421b..33ee665e731 100644 --- a/crates/rome_js_syntax/src/expr_ext.rs +++ b/crates/rome_js_syntax/src/expr_ext.rs @@ -707,7 +707,7 @@ impl JsIdentifierExpression { impl AnyJsLiteralExpression { pub fn value_token(&self) -> SyntaxResult { match self { - AnyJsLiteralExpression::JsBigIntLiteralExpression(expression) => { + AnyJsLiteralExpression::JsBigintLiteralExpression(expression) => { expression.value_token() } AnyJsLiteralExpression::JsBooleanLiteralExpression(expression) => { diff --git a/crates/rome_js_syntax/src/generated/kind.rs b/crates/rome_js_syntax/src/generated/kind.rs index 2a4a23354ae..dd53cd9c970 100644 --- a/crates/rome_js_syntax/src/generated/kind.rs +++ b/crates/rome_js_syntax/src/generated/kind.rs @@ -150,7 +150,7 @@ pub enum JsSyntaxKind { OVERRIDE_KW, OF_KW, JS_NUMBER_LITERAL, - JS_BIG_INT_LITERAL, + JS_BIGINT_LITERAL, JS_STRING_LITERAL, JS_REGEX_LITERAL, JSX_TEXT_LITERAL, @@ -258,7 +258,7 @@ pub enum JsSyntaxKind { JS_CALL_ARGUMENT_LIST, JS_STRING_LITERAL_EXPRESSION, JS_NUMBER_LITERAL_EXPRESSION, - JS_BIG_INT_LITERAL_EXPRESSION, + JS_BIGINT_LITERAL_EXPRESSION, JS_BOOLEAN_LITERAL_EXPRESSION, JS_NULL_LITERAL_EXPRESSION, JS_REGEX_LITERAL_EXPRESSION, @@ -429,7 +429,7 @@ pub enum JsSyntaxKind { TS_DEFAULT_TYPE_CLAUSE, TS_STRING_LITERAL_TYPE, TS_NUMBER_LITERAL_TYPE, - TS_BIG_INT_LITERAL_TYPE, + TS_BIGINT_LITERAL_TYPE, TS_BOOLEAN_LITERAL_TYPE, TS_NULL_LITERAL_TYPE, TS_TEMPLATE_LITERAL_TYPE, @@ -515,7 +515,7 @@ impl JsSyntaxKind { } pub const fn is_literal(self) -> bool { match self { - JS_NUMBER_LITERAL | JS_BIG_INT_LITERAL | JS_STRING_LITERAL | JS_REGEX_LITERAL + JS_NUMBER_LITERAL | JS_BIGINT_LITERAL | JS_STRING_LITERAL | JS_REGEX_LITERAL | JSX_TEXT_LITERAL | JSX_STRING_LITERAL => true, _ => false, } diff --git a/crates/rome_js_syntax/src/generated/macros.rs b/crates/rome_js_syntax/src/generated/macros.rs index d21ec3f1a2e..300a8862c4b 100644 --- a/crates/rome_js_syntax/src/generated/macros.rs +++ b/crates/rome_js_syntax/src/generated/macros.rs @@ -63,9 +63,9 @@ macro_rules! map_syntax_node { let $pattern = unsafe { $crate::JsAwaitExpression::new_unchecked(node) }; $body } - $crate::JsSyntaxKind::JS_BIG_INT_LITERAL_EXPRESSION => { + $crate::JsSyntaxKind::JS_BIGINT_LITERAL_EXPRESSION => { let $pattern = - unsafe { $crate::JsBigIntLiteralExpression::new_unchecked(node) }; + unsafe { $crate::JsBigintLiteralExpression::new_unchecked(node) }; $body } $crate::JsSyntaxKind::JS_BINARY_EXPRESSION => { @@ -759,8 +759,8 @@ macro_rules! map_syntax_node { let $pattern = unsafe { $crate::TsAssertsReturnType::new_unchecked(node) }; $body } - $crate::JsSyntaxKind::TS_BIG_INT_LITERAL_TYPE => { - let $pattern = unsafe { $crate::TsBigIntLiteralType::new_unchecked(node) }; + $crate::JsSyntaxKind::TS_BIGINT_LITERAL_TYPE => { + let $pattern = unsafe { $crate::TsBigintLiteralType::new_unchecked(node) }; $body } $crate::JsSyntaxKind::TS_BIGINT_TYPE => { diff --git a/crates/rome_js_syntax/src/generated/nodes.rs b/crates/rome_js_syntax/src/generated/nodes.rs index 379ee21e715..68b4152c698 100644 --- a/crates/rome_js_syntax/src/generated/nodes.rs +++ b/crates/rome_js_syntax/src/generated/nodes.rs @@ -471,10 +471,10 @@ pub struct JsAwaitExpressionFields { pub argument: SyntaxResult, } #[derive(Clone, PartialEq, Eq, Hash)] -pub struct JsBigIntLiteralExpression { +pub struct JsBigintLiteralExpression { pub(crate) syntax: SyntaxNode, } -impl JsBigIntLiteralExpression { +impl JsBigintLiteralExpression { #[doc = r" Create an AstNode from a SyntaxNode without checking its kind"] #[doc = r""] #[doc = r" # Safety"] @@ -482,8 +482,8 @@ impl JsBigIntLiteralExpression { #[doc = r" or a match on [SyntaxNode::kind]"] #[inline] pub const unsafe fn new_unchecked(syntax: SyntaxNode) -> Self { Self { syntax } } - pub fn as_fields(&self) -> JsBigIntLiteralExpressionFields { - JsBigIntLiteralExpressionFields { + pub fn as_fields(&self) -> JsBigintLiteralExpressionFields { + JsBigintLiteralExpressionFields { value_token: self.value_token(), } } @@ -492,7 +492,7 @@ impl JsBigIntLiteralExpression { } } #[cfg(feature = "serde")] -impl Serialize for JsBigIntLiteralExpression { +impl Serialize for JsBigintLiteralExpression { fn serialize(&self, serializer: S) -> Result where S: Serializer, @@ -501,7 +501,7 @@ impl Serialize for JsBigIntLiteralExpression { } } #[cfg_attr(feature = "serde", derive(Serialize))] -pub struct JsBigIntLiteralExpressionFields { +pub struct JsBigintLiteralExpressionFields { pub value_token: SyntaxResult, } #[derive(Clone, PartialEq, Eq, Hash)] @@ -7737,10 +7737,10 @@ pub struct TsAssertsReturnTypeFields { pub predicate: Option, } #[derive(Clone, PartialEq, Eq, Hash)] -pub struct TsBigIntLiteralType { +pub struct TsBigintLiteralType { pub(crate) syntax: SyntaxNode, } -impl TsBigIntLiteralType { +impl TsBigintLiteralType { #[doc = r" Create an AstNode from a SyntaxNode without checking its kind"] #[doc = r""] #[doc = r" # Safety"] @@ -7748,8 +7748,8 @@ impl TsBigIntLiteralType { #[doc = r" or a match on [SyntaxNode::kind]"] #[inline] pub const unsafe fn new_unchecked(syntax: SyntaxNode) -> Self { Self { syntax } } - pub fn as_fields(&self) -> TsBigIntLiteralTypeFields { - TsBigIntLiteralTypeFields { + pub fn as_fields(&self) -> TsBigintLiteralTypeFields { + TsBigintLiteralTypeFields { minus_token: self.minus_token(), literal_token: self.literal_token(), } @@ -7760,7 +7760,7 @@ impl TsBigIntLiteralType { } } #[cfg(feature = "serde")] -impl Serialize for TsBigIntLiteralType { +impl Serialize for TsBigintLiteralType { fn serialize(&self, serializer: S) -> Result where S: Serializer, @@ -7769,7 +7769,7 @@ impl Serialize for TsBigIntLiteralType { } } #[cfg_attr(feature = "serde", derive(Serialize))] -pub struct TsBigIntLiteralTypeFields { +pub struct TsBigintLiteralTypeFields { pub minus_token: Option, pub literal_token: SyntaxResult, } @@ -13330,7 +13330,7 @@ impl AnyJsInProperty { #[derive(Clone, PartialEq, Eq, Hash)] #[cfg_attr(feature = "serde", derive(Serialize))] pub enum AnyJsLiteralExpression { - JsBigIntLiteralExpression(JsBigIntLiteralExpression), + JsBigintLiteralExpression(JsBigintLiteralExpression), JsBooleanLiteralExpression(JsBooleanLiteralExpression), JsNullLiteralExpression(JsNullLiteralExpression), JsNumberLiteralExpression(JsNumberLiteralExpression), @@ -13338,9 +13338,9 @@ pub enum AnyJsLiteralExpression { JsStringLiteralExpression(JsStringLiteralExpression), } impl AnyJsLiteralExpression { - pub fn as_js_big_int_literal_expression(&self) -> Option<&JsBigIntLiteralExpression> { + pub fn as_js_bigint_literal_expression(&self) -> Option<&JsBigintLiteralExpression> { match &self { - AnyJsLiteralExpression::JsBigIntLiteralExpression(item) => Some(item), + AnyJsLiteralExpression::JsBigintLiteralExpression(item) => Some(item), _ => None, } } @@ -14596,7 +14596,7 @@ impl AnyTsTupleTypeElement { pub enum AnyTsType { TsAnyType(TsAnyType), TsArrayType(TsArrayType), - TsBigIntLiteralType(TsBigIntLiteralType), + TsBigintLiteralType(TsBigintLiteralType), TsBigintType(TsBigintType), TsBogusType(TsBogusType), TsBooleanLiteralType(TsBooleanLiteralType), @@ -14643,9 +14643,9 @@ impl AnyTsType { _ => None, } } - pub fn as_ts_big_int_literal_type(&self) -> Option<&TsBigIntLiteralType> { + pub fn as_ts_bigint_literal_type(&self) -> Option<&TsBigintLiteralType> { match &self { - AnyTsType::TsBigIntLiteralType(item) => Some(item), + AnyTsType::TsBigintLiteralType(item) => Some(item), _ => None, } } @@ -15314,11 +15314,11 @@ impl From for SyntaxNode { impl From for SyntaxElement { fn from(n: JsAwaitExpression) -> SyntaxElement { n.syntax.into() } } -impl AstNode for JsBigIntLiteralExpression { +impl AstNode for JsBigintLiteralExpression { type Language = Language; const KIND_SET: SyntaxKindSet = - SyntaxKindSet::from_raw(RawSyntaxKind(JS_BIG_INT_LITERAL_EXPRESSION as u16)); - fn can_cast(kind: SyntaxKind) -> bool { kind == JS_BIG_INT_LITERAL_EXPRESSION } + SyntaxKindSet::from_raw(RawSyntaxKind(JS_BIGINT_LITERAL_EXPRESSION as u16)); + fn can_cast(kind: SyntaxKind) -> bool { kind == JS_BIGINT_LITERAL_EXPRESSION } fn cast(syntax: SyntaxNode) -> Option { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -15329,9 +15329,9 @@ impl AstNode for JsBigIntLiteralExpression { fn syntax(&self) -> &SyntaxNode { &self.syntax } fn into_syntax(self) -> SyntaxNode { self.syntax } } -impl std::fmt::Debug for JsBigIntLiteralExpression { +impl std::fmt::Debug for JsBigintLiteralExpression { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - f.debug_struct("JsBigIntLiteralExpression") + f.debug_struct("JsBigintLiteralExpression") .field( "value_token", &support::DebugSyntaxResult(self.value_token()), @@ -15339,11 +15339,11 @@ impl std::fmt::Debug for JsBigIntLiteralExpression { .finish() } } -impl From for SyntaxNode { - fn from(n: JsBigIntLiteralExpression) -> SyntaxNode { n.syntax } +impl From for SyntaxNode { + fn from(n: JsBigintLiteralExpression) -> SyntaxNode { n.syntax } } -impl From for SyntaxElement { - fn from(n: JsBigIntLiteralExpression) -> SyntaxElement { n.syntax.into() } +impl From for SyntaxElement { + fn from(n: JsBigintLiteralExpression) -> SyntaxElement { n.syntax.into() } } impl AstNode for JsBinaryExpression { type Language = Language; @@ -21239,11 +21239,11 @@ impl From for SyntaxNode { impl From for SyntaxElement { fn from(n: TsAssertsReturnType) -> SyntaxElement { n.syntax.into() } } -impl AstNode for TsBigIntLiteralType { +impl AstNode for TsBigintLiteralType { type Language = Language; const KIND_SET: SyntaxKindSet = - SyntaxKindSet::from_raw(RawSyntaxKind(TS_BIG_INT_LITERAL_TYPE as u16)); - fn can_cast(kind: SyntaxKind) -> bool { kind == TS_BIG_INT_LITERAL_TYPE } + SyntaxKindSet::from_raw(RawSyntaxKind(TS_BIGINT_LITERAL_TYPE as u16)); + fn can_cast(kind: SyntaxKind) -> bool { kind == TS_BIGINT_LITERAL_TYPE } fn cast(syntax: SyntaxNode) -> Option { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -21254,9 +21254,9 @@ impl AstNode for TsBigIntLiteralType { fn syntax(&self) -> &SyntaxNode { &self.syntax } fn into_syntax(self) -> SyntaxNode { self.syntax } } -impl std::fmt::Debug for TsBigIntLiteralType { +impl std::fmt::Debug for TsBigintLiteralType { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - f.debug_struct("TsBigIntLiteralType") + f.debug_struct("TsBigintLiteralType") .field( "minus_token", &support::DebugOptionalElement(self.minus_token()), @@ -21268,11 +21268,11 @@ impl std::fmt::Debug for TsBigIntLiteralType { .finish() } } -impl From for SyntaxNode { - fn from(n: TsBigIntLiteralType) -> SyntaxNode { n.syntax } +impl From for SyntaxNode { + fn from(n: TsBigintLiteralType) -> SyntaxNode { n.syntax } } -impl From for SyntaxElement { - fn from(n: TsBigIntLiteralType) -> SyntaxElement { n.syntax.into() } +impl From for SyntaxElement { + fn from(n: TsBigintLiteralType) -> SyntaxElement { n.syntax.into() } } impl AstNode for TsBigintType { type Language = Language; @@ -28000,9 +28000,9 @@ impl From for SyntaxElement { node.into() } } -impl From for AnyJsLiteralExpression { - fn from(node: JsBigIntLiteralExpression) -> AnyJsLiteralExpression { - AnyJsLiteralExpression::JsBigIntLiteralExpression(node) +impl From for AnyJsLiteralExpression { + fn from(node: JsBigintLiteralExpression) -> AnyJsLiteralExpression { + AnyJsLiteralExpression::JsBigintLiteralExpression(node) } } impl From for AnyJsLiteralExpression { @@ -28032,7 +28032,7 @@ impl From for AnyJsLiteralExpression { } impl AstNode for AnyJsLiteralExpression { type Language = Language; - const KIND_SET: SyntaxKindSet = JsBigIntLiteralExpression::KIND_SET + const KIND_SET: SyntaxKindSet = JsBigintLiteralExpression::KIND_SET .union(JsBooleanLiteralExpression::KIND_SET) .union(JsNullLiteralExpression::KIND_SET) .union(JsNumberLiteralExpression::KIND_SET) @@ -28041,7 +28041,7 @@ impl AstNode for AnyJsLiteralExpression { fn can_cast(kind: SyntaxKind) -> bool { matches!( kind, - JS_BIG_INT_LITERAL_EXPRESSION + JS_BIGINT_LITERAL_EXPRESSION | JS_BOOLEAN_LITERAL_EXPRESSION | JS_NULL_LITERAL_EXPRESSION | JS_NUMBER_LITERAL_EXPRESSION @@ -28051,8 +28051,8 @@ impl AstNode for AnyJsLiteralExpression { } fn cast(syntax: SyntaxNode) -> Option { let res = match syntax.kind() { - JS_BIG_INT_LITERAL_EXPRESSION => { - AnyJsLiteralExpression::JsBigIntLiteralExpression(JsBigIntLiteralExpression { + JS_BIGINT_LITERAL_EXPRESSION => { + AnyJsLiteralExpression::JsBigintLiteralExpression(JsBigintLiteralExpression { syntax, }) } @@ -28085,7 +28085,7 @@ impl AstNode for AnyJsLiteralExpression { } fn syntax(&self) -> &SyntaxNode { match self { - AnyJsLiteralExpression::JsBigIntLiteralExpression(it) => &it.syntax, + AnyJsLiteralExpression::JsBigintLiteralExpression(it) => &it.syntax, AnyJsLiteralExpression::JsBooleanLiteralExpression(it) => &it.syntax, AnyJsLiteralExpression::JsNullLiteralExpression(it) => &it.syntax, AnyJsLiteralExpression::JsNumberLiteralExpression(it) => &it.syntax, @@ -28095,7 +28095,7 @@ impl AstNode for AnyJsLiteralExpression { } fn into_syntax(self) -> SyntaxNode { match self { - AnyJsLiteralExpression::JsBigIntLiteralExpression(it) => it.syntax, + AnyJsLiteralExpression::JsBigintLiteralExpression(it) => it.syntax, AnyJsLiteralExpression::JsBooleanLiteralExpression(it) => it.syntax, AnyJsLiteralExpression::JsNullLiteralExpression(it) => it.syntax, AnyJsLiteralExpression::JsNumberLiteralExpression(it) => it.syntax, @@ -28107,7 +28107,7 @@ impl AstNode for AnyJsLiteralExpression { impl std::fmt::Debug for AnyJsLiteralExpression { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { - AnyJsLiteralExpression::JsBigIntLiteralExpression(it) => std::fmt::Debug::fmt(it, f), + AnyJsLiteralExpression::JsBigintLiteralExpression(it) => std::fmt::Debug::fmt(it, f), AnyJsLiteralExpression::JsBooleanLiteralExpression(it) => std::fmt::Debug::fmt(it, f), AnyJsLiteralExpression::JsNullLiteralExpression(it) => std::fmt::Debug::fmt(it, f), AnyJsLiteralExpression::JsNumberLiteralExpression(it) => std::fmt::Debug::fmt(it, f), @@ -28119,7 +28119,7 @@ impl std::fmt::Debug for AnyJsLiteralExpression { impl From for SyntaxNode { fn from(n: AnyJsLiteralExpression) -> SyntaxNode { match n { - AnyJsLiteralExpression::JsBigIntLiteralExpression(it) => it.into(), + AnyJsLiteralExpression::JsBigintLiteralExpression(it) => it.into(), AnyJsLiteralExpression::JsBooleanLiteralExpression(it) => it.into(), AnyJsLiteralExpression::JsNullLiteralExpression(it) => it.into(), AnyJsLiteralExpression::JsNumberLiteralExpression(it) => it.into(), @@ -31332,8 +31332,8 @@ impl From for AnyTsType { impl From for AnyTsType { fn from(node: TsArrayType) -> AnyTsType { AnyTsType::TsArrayType(node) } } -impl From for AnyTsType { - fn from(node: TsBigIntLiteralType) -> AnyTsType { AnyTsType::TsBigIntLiteralType(node) } +impl From for AnyTsType { + fn from(node: TsBigintLiteralType) -> AnyTsType { AnyTsType::TsBigintLiteralType(node) } } impl From for AnyTsType { fn from(node: TsBigintType) -> AnyTsType { AnyTsType::TsBigintType(node) } @@ -31435,7 +31435,7 @@ impl AstNode for AnyTsType { type Language = Language; const KIND_SET: SyntaxKindSet = TsAnyType::KIND_SET .union(TsArrayType::KIND_SET) - .union(TsBigIntLiteralType::KIND_SET) + .union(TsBigintLiteralType::KIND_SET) .union(TsBigintType::KIND_SET) .union(TsBogusType::KIND_SET) .union(TsBooleanLiteralType::KIND_SET) @@ -31473,7 +31473,7 @@ impl AstNode for AnyTsType { kind, TS_ANY_TYPE | TS_ARRAY_TYPE - | TS_BIG_INT_LITERAL_TYPE + | TS_BIGINT_LITERAL_TYPE | TS_BIGINT_TYPE | TS_BOGUS_TYPE | TS_BOOLEAN_LITERAL_TYPE @@ -31512,8 +31512,8 @@ impl AstNode for AnyTsType { let res = match syntax.kind() { TS_ANY_TYPE => AnyTsType::TsAnyType(TsAnyType { syntax }), TS_ARRAY_TYPE => AnyTsType::TsArrayType(TsArrayType { syntax }), - TS_BIG_INT_LITERAL_TYPE => { - AnyTsType::TsBigIntLiteralType(TsBigIntLiteralType { syntax }) + TS_BIGINT_LITERAL_TYPE => { + AnyTsType::TsBigintLiteralType(TsBigintLiteralType { syntax }) } TS_BIGINT_TYPE => AnyTsType::TsBigintType(TsBigintType { syntax }), TS_BOGUS_TYPE => AnyTsType::TsBogusType(TsBogusType { syntax }), @@ -31565,7 +31565,7 @@ impl AstNode for AnyTsType { match self { AnyTsType::TsAnyType(it) => &it.syntax, AnyTsType::TsArrayType(it) => &it.syntax, - AnyTsType::TsBigIntLiteralType(it) => &it.syntax, + AnyTsType::TsBigintLiteralType(it) => &it.syntax, AnyTsType::TsBigintType(it) => &it.syntax, AnyTsType::TsBogusType(it) => &it.syntax, AnyTsType::TsBooleanLiteralType(it) => &it.syntax, @@ -31604,7 +31604,7 @@ impl AstNode for AnyTsType { match self { AnyTsType::TsAnyType(it) => it.syntax, AnyTsType::TsArrayType(it) => it.syntax, - AnyTsType::TsBigIntLiteralType(it) => it.syntax, + AnyTsType::TsBigintLiteralType(it) => it.syntax, AnyTsType::TsBigintType(it) => it.syntax, AnyTsType::TsBogusType(it) => it.syntax, AnyTsType::TsBooleanLiteralType(it) => it.syntax, @@ -31645,7 +31645,7 @@ impl std::fmt::Debug for AnyTsType { match self { AnyTsType::TsAnyType(it) => std::fmt::Debug::fmt(it, f), AnyTsType::TsArrayType(it) => std::fmt::Debug::fmt(it, f), - AnyTsType::TsBigIntLiteralType(it) => std::fmt::Debug::fmt(it, f), + AnyTsType::TsBigintLiteralType(it) => std::fmt::Debug::fmt(it, f), AnyTsType::TsBigintType(it) => std::fmt::Debug::fmt(it, f), AnyTsType::TsBogusType(it) => std::fmt::Debug::fmt(it, f), AnyTsType::TsBooleanLiteralType(it) => std::fmt::Debug::fmt(it, f), @@ -31686,7 +31686,7 @@ impl From for SyntaxNode { match n { AnyTsType::TsAnyType(it) => it.into(), AnyTsType::TsArrayType(it) => it.into(), - AnyTsType::TsBigIntLiteralType(it) => it.into(), + AnyTsType::TsBigintLiteralType(it) => it.into(), AnyTsType::TsBigintType(it) => it.into(), AnyTsType::TsBogusType(it) => it.into(), AnyTsType::TsBooleanLiteralType(it) => it.into(), @@ -32407,7 +32407,7 @@ impl std::fmt::Display for JsAwaitExpression { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for JsBigIntLiteralExpression { +impl std::fmt::Display for JsBigintLiteralExpression { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } @@ -33237,7 +33237,7 @@ impl std::fmt::Display for TsAssertsReturnType { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for TsBigIntLiteralType { +impl std::fmt::Display for TsBigintLiteralType { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } diff --git a/crates/rome_js_syntax/src/generated/nodes_mut.rs b/crates/rome_js_syntax/src/generated/nodes_mut.rs index cbf59e5233a..1aeb5575ddd 100644 --- a/crates/rome_js_syntax/src/generated/nodes_mut.rs +++ b/crates/rome_js_syntax/src/generated/nodes_mut.rs @@ -192,7 +192,7 @@ impl JsAwaitExpression { ) } } -impl JsBigIntLiteralExpression { +impl JsBigintLiteralExpression { pub fn with_value_token(self, element: SyntaxToken) -> Self { Self::unwrap_cast( self.syntax @@ -3788,7 +3788,7 @@ impl TsAssertsReturnType { )) } } -impl TsBigIntLiteralType { +impl TsBigintLiteralType { pub fn with_minus_token(self, element: Option) -> Self { Self::unwrap_cast( self.syntax diff --git a/crates/rome_js_unicode_table/src/tables.rs b/crates/rome_js_unicode_table/src/tables.rs index 7f67057597c..3ed00b03214 100644 --- a/crates/rome_js_unicode_table/src/tables.rs +++ b/crates/rome_js_unicode_table/src/tables.rs @@ -176,7 +176,7 @@ pub mod derived_property { ('ೝ', 'ೞ'), ('ೠ', '\u{ce3}'), ('೦', '೯'), - ('ೱ', '\u{cf3}'), + ('ೱ', 'ೳ'), ('\u{d00}', 'ഌ'), ('എ', 'ഐ'), ('ഒ', '\u{d44}'), @@ -626,16 +626,16 @@ pub mod derived_property { ('𑶓', '𑶘'), ('𑶠', '𑶩'), ('𑻠', '𑻶'), - ('\u{11f00}', '\u{11f10}'), - ('\u{11f12}', '\u{11f3a}'), - ('\u{11f3e}', '\u{11f42}'), - ('\u{11f50}', '\u{11f59}'), + ('\u{11f00}', '𑼐'), + ('𑼒', '\u{11f3a}'), + ('𑼾', '\u{11f42}'), + ('𑽐', '𑽙'), ('𑾰', '𑾰'), ('𒀀', '𒎙'), ('𒐀', '𒑮'), ('𒒀', '𒕃'), ('𒾐', '𒿰'), - ('𓀀', '\u{1342f}'), + ('𓀀', '𓐯'), ('\u{13440}', '\u{13455}'), ('𔐀', '𔙆'), ('𖠀', '𖨸'), @@ -664,9 +664,9 @@ pub mod derived_property { ('𚿵', '𚿻'), ('𚿽', '𚿾'), ('𛀀', '𛄢'), - ('\u{1b132}', '\u{1b132}'), + ('𛄲', '𛄲'), ('𛅐', '𛅒'), - ('\u{1b155}', '\u{1b155}'), + ('𛅕', '𛅕'), ('𛅤', '𛅧'), ('𛅰', '𛋻'), ('𛰀', '𛱪'), @@ -720,13 +720,13 @@ pub mod derived_property { ('\u{1da9b}', '\u{1da9f}'), ('\u{1daa1}', '\u{1daaf}'), ('𝼀', '𝼞'), - ('\u{1df25}', '\u{1df2a}'), + ('𝼥', '𝼪'), ('\u{1e000}', '\u{1e006}'), ('\u{1e008}', '\u{1e018}'), ('\u{1e01b}', '\u{1e021}'), ('\u{1e023}', '\u{1e024}'), ('\u{1e026}', '\u{1e02a}'), - ('\u{1e030}', '\u{1e06d}'), + ('𞀰', '𞁭'), ('\u{1e08f}', '\u{1e08f}'), ('𞄀', '𞄬'), ('\u{1e130}', '𞄽'), @@ -734,7 +734,7 @@ pub mod derived_property { ('𞅎', '𞅎'), ('𞊐', '\u{1e2ae}'), ('𞋀', '𞋹'), - ('\u{1e4d0}', '\u{1e4f9}'), + ('𞓐', '𞓹'), ('𞟠', '𞟦'), ('𞟨', '𞟫'), ('𞟭', '𞟮'), @@ -778,13 +778,13 @@ pub mod derived_property { ('𞺫', '𞺻'), ('🯰', '🯹'), ('𠀀', '𪛟'), - ('𪜀', '\u{2b739}'), + ('𪜀', '𫜹'), ('𫝀', '𫠝'), ('𫠠', '𬺡'), ('𬺰', '𮯠'), ('丽', '𪘀'), ('𰀀', '𱍊'), - ('\u{31350}', '\u{323af}'), + ('𱍐', '𲎯'), ('\u{e0100}', '\u{e01ef}'), ]; pub fn ID_Continue(c: char) -> bool { @@ -1259,7 +1259,7 @@ pub mod derived_property { ('𑇜', '𑇜'), ('𑈀', '𑈑'), ('𑈓', '𑈫'), - ('\u{1123f}', '\u{11240}'), + ('𑈿', '𑉀'), ('𑊀', '𑊆'), ('𑊈', '𑊈'), ('𑊊', '𑊍'), @@ -1322,16 +1322,16 @@ pub mod derived_property { ('𑵪', '𑶉'), ('𑶘', '𑶘'), ('𑻠', '𑻲'), - ('\u{11f02}', '\u{11f02}'), - ('\u{11f04}', '\u{11f10}'), - ('\u{11f12}', '\u{11f33}'), + ('𑼂', '𑼂'), + ('𑼄', '𑼐'), + ('𑼒', '𑼳'), ('𑾰', '𑾰'), ('𒀀', '𒎙'), ('𒐀', '𒑮'), ('𒒀', '𒕃'), ('𒾐', '𒿰'), - ('𓀀', '\u{1342f}'), - ('\u{13441}', '\u{13446}'), + ('𓀀', '𓐯'), + ('𓑁', '𓑆'), ('𔐀', '𔙆'), ('𖠀', '𖨸'), ('𖩀', '𖩞'), @@ -1354,9 +1354,9 @@ pub mod derived_property { ('𚿵', '𚿻'), ('𚿽', '𚿾'), ('𛀀', '𛄢'), - ('\u{1b132}', '\u{1b132}'), + ('𛄲', '𛄲'), ('𛅐', '𛅒'), - ('\u{1b155}', '\u{1b155}'), + ('𛅕', '𛅕'), ('𛅤', '𛅧'), ('𛅰', '𛋻'), ('𛰀', '𛱪'), @@ -1394,14 +1394,14 @@ pub mod derived_property { ('𝞪', '𝟂'), ('𝟄', '𝟋'), ('𝼀', '𝼞'), - ('\u{1df25}', '\u{1df2a}'), - ('\u{1e030}', '\u{1e06d}'), + ('𝼥', '𝼪'), + ('𞀰', '𞁭'), ('𞄀', '𞄬'), ('𞄷', '𞄽'), ('𞅎', '𞅎'), ('𞊐', '𞊭'), ('𞋀', '𞋫'), - ('\u{1e4d0}', '\u{1e4eb}'), + ('𞓐', '𞓫'), ('𞟠', '𞟦'), ('𞟨', '𞟫'), ('𞟭', '𞟮'), @@ -1443,13 +1443,13 @@ pub mod derived_property { ('𞺥', '𞺩'), ('𞺫', '𞺻'), ('𠀀', '𪛟'), - ('𪜀', '\u{2b739}'), + ('𪜀', '𫜹'), ('𫝀', '𫠝'), ('𫠠', '𬺡'), ('𬺰', '𮯠'), ('丽', '𪘀'), ('𰀀', '𱍊'), - ('\u{31350}', '\u{323af}'), + ('𱍐', '𲎯'), ]; pub fn ID_Start(c: char) -> bool { super::bsearch_range_table(c, ID_Start_table) diff --git a/rfcs/001-js-grammar.ungram b/rfcs/001-js-grammar.ungram index 1d3ddf9f7f4..0b97e300932 100644 --- a/rfcs/001-js-grammar.ungram +++ b/rfcs/001-js-grammar.ungram @@ -388,7 +388,7 @@ JsStringLiteral = value: 'js_string' JsNumberLiteral = value: 'js_number' // Called JsNumericLiteral in Rome, helper for retrieving representation (hex|octal| etc) // 45n -JsBigIntLiteral = value: 'js_big_int' // should the `n` be part of the big_int token or not? Should quotes be part of a string token? -> 5.5d is a numeric_token in roslyn +JsBigIntLiteral = value: 'js_bigint' // should the `n` be part of the bigint token or not? Should quotes be part of a string token? -> 5.5d is a numeric_token in roslyn // true, false JsBooleanLiteral = value: ('true' | 'false') diff --git a/xtask/codegen/js.ungram b/xtask/codegen/js.ungram index 97ac5fd9cb7..5beb8f3d6b6 100644 --- a/xtask/codegen/js.ungram +++ b/xtask/codegen/js.ungram @@ -1074,7 +1074,7 @@ JsObjectBindingPatternRest = AnyJsLiteralExpression = JsStringLiteralExpression | JsNumberLiteralExpression - | JsBigIntLiteralExpression + | JsBigintLiteralExpression | JsBooleanLiteralExpression | JsNullLiteralExpression | JsRegexLiteralExpression @@ -1086,7 +1086,7 @@ JsStringLiteralExpression = value: 'js_string_literal' JsNumberLiteralExpression = value: 'js_number_literal' // 45n -JsBigIntLiteralExpression = value: 'js_big_int_literal' +JsBigintLiteralExpression = value: 'js_bigint_literal' // true, false JsBooleanLiteralExpression = value_token: ('true' | 'false') @@ -1651,7 +1651,7 @@ AnyTsType = | TsNonPrimitiveType | TsThisType | TsNumberLiteralType - | TsBigIntLiteralType + | TsBigintLiteralType | TsStringLiteralType | TsNullLiteralType | TsBooleanLiteralType @@ -2113,7 +2113,7 @@ TsOptionalTupleTypeElement = TsStringLiteralType = literal: 'js_string_literal' TsNumberLiteralType = '-'? literal: 'js_number_literal' -TsBigIntLiteralType = '-'? literal: 'js_big_int_literal' +TsBigintLiteralType = '-'? literal: 'js_bigint_literal' TsBooleanLiteralType = literal: ('true' | 'false') TsNullLiteralType = literal: 'null' TsTemplateLiteralType = diff --git a/xtask/codegen/src/kinds_src.rs b/xtask/codegen/src/kinds_src.rs index 3a7bec7e2ee..c198c51840a 100644 --- a/xtask/codegen/src/kinds_src.rs +++ b/xtask/codegen/src/kinds_src.rs @@ -165,7 +165,7 @@ pub const JS_KINDS_SRC: KindsSrc = KindsSrc { ], literals: &[ "JS_NUMBER_LITERAL", - "JS_BIG_INT_LITERAL", + "JS_BIGINT_LITERAL", "JS_STRING_LITERAL", "JS_REGEX_LITERAL", "JSX_TEXT_LITERAL", @@ -277,7 +277,7 @@ pub const JS_KINDS_SRC: KindsSrc = KindsSrc { "JS_CALL_ARGUMENT_LIST", "JS_STRING_LITERAL_EXPRESSION", "JS_NUMBER_LITERAL_EXPRESSION", - "JS_BIG_INT_LITERAL_EXPRESSION", + "JS_BIGINT_LITERAL_EXPRESSION", "JS_BOOLEAN_LITERAL_EXPRESSION", "JS_NULL_LITERAL_EXPRESSION", "JS_REGEX_LITERAL_EXPRESSION", @@ -449,7 +449,7 @@ pub const JS_KINDS_SRC: KindsSrc = KindsSrc { "TS_DEFAULT_TYPE_CLAUSE", "TS_STRING_LITERAL_TYPE", "TS_NUMBER_LITERAL_TYPE", - "TS_BIG_INT_LITERAL_TYPE", + "TS_BIGINT_LITERAL_TYPE", "TS_BOOLEAN_LITERAL_TYPE", "TS_NULL_LITERAL_TYPE", "TS_TEMPLATE_LITERAL_TYPE",