From e2b4b86c7a7149f0f712e5bfc6ad5e3cc1889846 Mon Sep 17 00:00:00 2001 From: rzvxa Date: Tue, 25 Jun 2024 11:34:20 +0330 Subject: [PATCH] fix(ast): rename all instances of `BigintLiteral` to `BigIntLiteral`. --- crates/oxc_ast/src/ast/js.rs | 4 ++-- crates/oxc_ast/src/ast/macros.rs | 4 ++-- crates/oxc_ast/src/ast/ts.rs | 2 +- crates/oxc_ast/src/ast_builder.rs | 2 +- crates/oxc_ast/src/ast_impl/js.rs | 8 ++++---- crates/oxc_ast/src/ast_kind.rs | 10 +++++----- crates/oxc_ast/src/generated/span.rs | 18 +++++++++--------- crates/oxc_ast/src/visit/visit.rs | 6 +++--- crates/oxc_ast/src/visit/visit_mut.rs | 6 +++--- crates/oxc_codegen/src/gen.rs | 4 ++-- crates/oxc_isolated_declarations/src/class.rs | 4 ++-- .../oxc_isolated_declarations/src/inferrer.rs | 4 ++-- crates/oxc_isolated_declarations/src/types.rs | 4 ++-- crates/oxc_linter/src/rules/eslint/eqeqeq.rs | 2 +- .../src/rules/eslint/no_compare_neg_zero.rs | 2 +- .../oxc_linter/src/rules/jest/prefer_to_be.rs | 2 +- .../typescript/adjacent_overload_signatures.rs | 2 +- .../src/rules/unicorn/no_unnecessary_await.rs | 2 +- .../src/rules/unicorn/number_literal_case.rs | 2 +- .../rules/unicorn/numeric_separators_style.rs | 2 +- crates/oxc_minifier/src/compressor/ast_util.rs | 8 ++++---- crates/oxc_minifier/src/compressor/fold.rs | 8 ++++---- crates/oxc_parser/src/ts/types.rs | 2 +- crates/oxc_prettier/src/format/mod.rs | 4 ++-- crates/oxc_semantic/src/dot.rs | 2 +- crates/oxc_traverse/src/walk.rs | 18 +++++++++--------- 26 files changed, 66 insertions(+), 66 deletions(-) diff --git a/crates/oxc_ast/src/ast/js.rs b/crates/oxc_ast/src/ast/js.rs index 74e34deca8e23d..f16729a645bee7 100644 --- a/crates/oxc_ast/src/ast/js.rs +++ b/crates/oxc_ast/src/ast/js.rs @@ -55,7 +55,7 @@ pub enum Expression<'a> { BooleanLiteral(Box<'a, BooleanLiteral>) = 0, NullLiteral(Box<'a, NullLiteral>) = 1, NumericLiteral(Box<'a, NumericLiteral<'a>>) = 2, - BigintLiteral(Box<'a, BigIntLiteral<'a>>) = 3, + BigIntLiteral(Box<'a, BigIntLiteral<'a>>) = 3, RegExpLiteral(Box<'a, RegExpLiteral<'a>>) = 4, StringLiteral(Box<'a, StringLiteral<'a>>) = 5, TemplateLiteral(Box<'a, TemplateLiteral<'a>>) = 6, @@ -110,7 +110,7 @@ macro_rules! match_expression { $ty::BooleanLiteral(_) | $ty::NullLiteral(_) | $ty::NumericLiteral(_) - | $ty::BigintLiteral(_) + | $ty::BigIntLiteral(_) | $ty::RegExpLiteral(_) | $ty::StringLiteral(_) | $ty::TemplateLiteral(_) diff --git a/crates/oxc_ast/src/ast/macros.rs b/crates/oxc_ast/src/ast/macros.rs index 2c1e5179d7d059..698b1a2dbdd1ef 100644 --- a/crates/oxc_ast/src/ast/macros.rs +++ b/crates/oxc_ast/src/ast/macros.rs @@ -93,7 +93,7 @@ macro_rules! inherit_variants { /// Inherited from [`Expression`] NumericLiteral(Box<'a, NumericLiteral<'a>>) = 2, /// Inherited from [`Expression`] - BigintLiteral(Box<'a, BigIntLiteral<'a>>) = 3, + BigIntLiteral(Box<'a, BigIntLiteral<'a>>) = 3, /// Inherited from [`Expression`] RegExpLiteral(Box<'a, RegExpLiteral<'a>>) = 4, /// Inherited from [`Expression`] @@ -189,7 +189,7 @@ macro_rules! inherit_variants { BooleanLiteral, NullLiteral, NumericLiteral, - BigintLiteral, + BigIntLiteral, RegExpLiteral, StringLiteral, TemplateLiteral, diff --git a/crates/oxc_ast/src/ast/ts.rs b/crates/oxc_ast/src/ast/ts.rs index 2bdfc25d3c814a..9a616e29b6cca3 100644 --- a/crates/oxc_ast/src/ast/ts.rs +++ b/crates/oxc_ast/src/ast/ts.rs @@ -122,7 +122,7 @@ pub enum TSLiteral<'a> { BooleanLiteral(Box<'a, BooleanLiteral>), NullLiteral(Box<'a, NullLiteral>), NumericLiteral(Box<'a, NumericLiteral<'a>>), - BigintLiteral(Box<'a, BigIntLiteral<'a>>), + BigIntLiteral(Box<'a, BigIntLiteral<'a>>), RegExpLiteral(Box<'a, RegExpLiteral<'a>>), StringLiteral(Box<'a, StringLiteral<'a>>), TemplateLiteral(Box<'a, TemplateLiteral<'a>>), diff --git a/crates/oxc_ast/src/ast_builder.rs b/crates/oxc_ast/src/ast_builder.rs index c6f0412dc7c27e..10c01a5a680535 100644 --- a/crates/oxc_ast/src/ast_builder.rs +++ b/crates/oxc_ast/src/ast_builder.rs @@ -235,7 +235,7 @@ impl<'a> AstBuilder<'a> { #[inline] pub fn literal_bigint_expression(self, literal: BigIntLiteral<'a>) -> Expression<'a> { - Expression::BigintLiteral(self.alloc(literal)) + Expression::BigIntLiteral(self.alloc(literal)) } #[inline] diff --git a/crates/oxc_ast/src/ast_impl/js.rs b/crates/oxc_ast/src/ast_impl/js.rs index 0b015d12d884df..745008f665e898 100644 --- a/crates/oxc_ast/src/ast_impl/js.rs +++ b/crates/oxc_ast/src/ast_impl/js.rs @@ -94,7 +94,7 @@ impl<'a> Expression<'a> { Self::BooleanLiteral(_) | Self::NullLiteral(_) | Self::NumericLiteral(_) - | Self::BigintLiteral(_) + | Self::BigIntLiteral(_) | Self::RegExpLiteral(_) | Self::StringLiteral(_) ) @@ -246,7 +246,7 @@ impl<'a> Expression<'a> { Self::BooleanLiteral(lit) => Some(lit.value), Self::NullLiteral(_) => Some(false), Self::NumericLiteral(lit) => Some(lit.value != 0.0), - Self::BigintLiteral(lit) => Some(!lit.is_zero()), + Self::BigIntLiteral(lit) => Some(!lit.is_zero()), Self::RegExpLiteral(_) => Some(true), Self::StringLiteral(lit) => Some(!lit.value.is_empty()), _ => None, @@ -265,7 +265,7 @@ impl<'a> Expression<'a> { Self::BooleanLiteral(_) | Self::NullLiteral(_) | Self::NumericLiteral(_) - | Self::BigintLiteral(_) + | Self::BigIntLiteral(_) | Self::RegExpLiteral(_) | Self::StringLiteral(_) => true, Self::TemplateLiteral(lit) if lit.is_no_substitution_template() => true, @@ -337,7 +337,7 @@ impl<'a> PropertyKey<'a> { Self::StringLiteral(lit) => Some(lit.value.to_compact_str()), Self::RegExpLiteral(lit) => Some(lit.regex.to_string().into()), Self::NumericLiteral(lit) => Some(lit.value.to_string().into()), - Self::BigintLiteral(lit) => Some(lit.raw.to_compact_str()), + Self::BigIntLiteral(lit) => Some(lit.raw.to_compact_str()), Self::NullLiteral(_) => Some("null".into()), Self::TemplateLiteral(lit) => lit .expressions diff --git a/crates/oxc_ast/src/ast_kind.rs b/crates/oxc_ast/src/ast_kind.rs index b9cb6349bd45d6..84ae388d207ef0 100644 --- a/crates/oxc_ast/src/ast_kind.rs +++ b/crates/oxc_ast/src/ast_kind.rs @@ -62,7 +62,7 @@ ast_kinds! { StringLiteral(&'a StringLiteral<'a>), BooleanLiteral(&'a BooleanLiteral), NullLiteral(&'a NullLiteral), - BigintLiteral(&'a BigIntLiteral<'a>), + BigIntLiteral(&'a BigIntLiteral<'a>), RegExpLiteral(&'a RegExpLiteral<'a>), TemplateLiteral(&'a TemplateLiteral<'a>), @@ -271,7 +271,7 @@ impl<'a> AstKind<'a> { | Self::StringLiteral(_) | Self::BooleanLiteral(_) | Self::NullLiteral(_) - | Self::BigintLiteral(_) + | Self::BigIntLiteral(_) | Self::RegExpLiteral(_) | Self::TemplateLiteral(_) ) @@ -316,7 +316,7 @@ impl<'a> AstKind<'a> { Expression::BooleanLiteral(e) => Self::BooleanLiteral(e), Expression::NullLiteral(e) => Self::NullLiteral(e), Expression::NumericLiteral(e) => Self::NumericLiteral(e), - Expression::BigintLiteral(e) => Self::BigintLiteral(e), + Expression::BigIntLiteral(e) => Self::BigIntLiteral(e), Expression::RegExpLiteral(e) => Self::RegExpLiteral(e), Expression::StringLiteral(e) => Self::StringLiteral(e), Expression::TemplateLiteral(e) => Self::TemplateLiteral(e), @@ -406,7 +406,7 @@ impl<'a> GetSpan for AstKind<'a> { Self::StringLiteral(x) => x.span, Self::BooleanLiteral(x) => x.span, Self::NullLiteral(x) => x.span, - Self::BigintLiteral(x) => x.span, + Self::BigIntLiteral(x) => x.span, Self::RegExpLiteral(x) => x.span, Self::TemplateLiteral(x) => x.span, @@ -601,7 +601,7 @@ impl<'a> AstKind<'a> { Self::StringLiteral(s) => format!("StringLiteral({})", s.value).into(), Self::BooleanLiteral(b) => format!("BooleanLiteral({})", b.value).into(), Self::NullLiteral(_) => "NullLiteral".into(), - Self::BigintLiteral(b) => format!("BigintLiteral({})", b.raw).into(), + Self::BigIntLiteral(b) => format!("BigIntLiteral({})", b.raw).into(), Self::RegExpLiteral(r) => format!("RegExpLiteral({})", r.regex).into(), Self::TemplateLiteral(t) => format!( "TemplateLiteral({})", diff --git a/crates/oxc_ast/src/generated/span.rs b/crates/oxc_ast/src/generated/span.rs index 216b5293da7173..60f3e3ff46a3ef 100644 --- a/crates/oxc_ast/src/generated/span.rs +++ b/crates/oxc_ast/src/generated/span.rs @@ -61,7 +61,7 @@ impl<'a> GetSpan for Expression<'a> { Self::BooleanLiteral(it) => it.span(), Self::NullLiteral(it) => it.span(), Self::NumericLiteral(it) => it.span(), - Self::BigintLiteral(it) => it.span(), + Self::BigIntLiteral(it) => it.span(), Self::RegExpLiteral(it) => it.span(), Self::StringLiteral(it) => it.span(), Self::TemplateLiteral(it) => it.span(), @@ -154,7 +154,7 @@ impl<'a> GetSpan for ArrayExpressionElement<'a> { Self::BooleanLiteral(it) => it.span(), Self::NullLiteral(it) => it.span(), Self::NumericLiteral(it) => it.span(), - Self::BigintLiteral(it) => it.span(), + Self::BigIntLiteral(it) => it.span(), Self::RegExpLiteral(it) => it.span(), Self::StringLiteral(it) => it.span(), Self::TemplateLiteral(it) => it.span(), @@ -235,7 +235,7 @@ impl<'a> GetSpan for PropertyKey<'a> { Self::BooleanLiteral(it) => it.span(), Self::NullLiteral(it) => it.span(), Self::NumericLiteral(it) => it.span(), - Self::BigintLiteral(it) => it.span(), + Self::BigIntLiteral(it) => it.span(), Self::RegExpLiteral(it) => it.span(), Self::StringLiteral(it) => it.span(), Self::TemplateLiteral(it) => it.span(), @@ -365,7 +365,7 @@ impl<'a> GetSpan for Argument<'a> { Self::BooleanLiteral(it) => it.span(), Self::NullLiteral(it) => it.span(), Self::NumericLiteral(it) => it.span(), - Self::BigintLiteral(it) => it.span(), + Self::BigIntLiteral(it) => it.span(), Self::RegExpLiteral(it) => it.span(), Self::StringLiteral(it) => it.span(), Self::TemplateLiteral(it) => it.span(), @@ -764,7 +764,7 @@ impl<'a> GetSpan for ForStatementInit<'a> { Self::BooleanLiteral(it) => it.span(), Self::NullLiteral(it) => it.span(), Self::NumericLiteral(it) => it.span(), - Self::BigintLiteral(it) => it.span(), + Self::BigIntLiteral(it) => it.span(), Self::RegExpLiteral(it) => it.span(), Self::StringLiteral(it) => it.span(), Self::TemplateLiteral(it) => it.span(), @@ -1192,7 +1192,7 @@ impl<'a> GetSpan for ExportDefaultDeclarationKind<'a> { Self::BooleanLiteral(it) => it.span(), Self::NullLiteral(it) => it.span(), Self::NumericLiteral(it) => it.span(), - Self::BigintLiteral(it) => it.span(), + Self::BigIntLiteral(it) => it.span(), Self::RegExpLiteral(it) => it.span(), Self::StringLiteral(it) => it.span(), Self::TemplateLiteral(it) => it.span(), @@ -1275,7 +1275,7 @@ impl<'a> GetSpan for TSEnumMemberName<'a> { Self::BooleanLiteral(it) => it.span(), Self::NullLiteral(it) => it.span(), Self::NumericLiteral(it) => it.span(), - Self::BigintLiteral(it) => it.span(), + Self::BigIntLiteral(it) => it.span(), Self::RegExpLiteral(it) => it.span(), Self::StringLiteral(it) => it.span(), Self::TemplateLiteral(it) => it.span(), @@ -1338,7 +1338,7 @@ impl<'a> GetSpan for TSLiteral<'a> { Self::BooleanLiteral(it) => it.span(), Self::NullLiteral(it) => it.span(), Self::NumericLiteral(it) => it.span(), - Self::BigintLiteral(it) => it.span(), + Self::BigIntLiteral(it) => it.span(), Self::RegExpLiteral(it) => it.span(), Self::StringLiteral(it) => it.span(), Self::TemplateLiteral(it) => it.span(), @@ -2042,7 +2042,7 @@ impl<'a> GetSpan for JSXExpression<'a> { Self::BooleanLiteral(it) => it.span(), Self::NullLiteral(it) => it.span(), Self::NumericLiteral(it) => it.span(), - Self::BigintLiteral(it) => it.span(), + Self::BigIntLiteral(it) => it.span(), Self::RegExpLiteral(it) => it.span(), Self::StringLiteral(it) => it.span(), Self::TemplateLiteral(it) => it.span(), diff --git a/crates/oxc_ast/src/visit/visit.rs b/crates/oxc_ast/src/visit/visit.rs index 022a7a887000e9..532357f738cbc2 100644 --- a/crates/oxc_ast/src/visit/visit.rs +++ b/crates/oxc_ast/src/visit/visit.rs @@ -1472,7 +1472,7 @@ pub mod walk { pub fn walk_expression<'a, V: Visit<'a>>(visitor: &mut V, expr: &Expression<'a>) { match expr { - Expression::BigintLiteral(lit) => visitor.visit_bigint_literal(lit), + Expression::BigIntLiteral(lit) => visitor.visit_bigint_literal(lit), Expression::BooleanLiteral(lit) => visitor.visit_boolean_literal(lit), Expression::NullLiteral(lit) => visitor.visit_null_literal(lit), Expression::NumericLiteral(lit) => visitor.visit_number_literal(lit), @@ -2316,7 +2316,7 @@ pub mod walk { } pub fn walk_bigint_literal<'a, V: Visit<'a>>(visitor: &mut V, lit: &BigIntLiteral<'a>) { - let kind = AstKind::BigintLiteral(visitor.alloc(lit)); + let kind = AstKind::BigIntLiteral(visitor.alloc(lit)); visitor.enter_node(kind); visitor.leave_node(kind); } @@ -3006,7 +3006,7 @@ pub mod walk { let kind = AstKind::TSLiteralType(visitor.alloc(ty)); visitor.enter_node(kind); match &ty.literal { - TSLiteral::BigintLiteral(lit) => visitor.visit_bigint_literal(lit), + TSLiteral::BigIntLiteral(lit) => visitor.visit_bigint_literal(lit), TSLiteral::BooleanLiteral(lit) => visitor.visit_boolean_literal(lit), TSLiteral::NullLiteral(lit) => visitor.visit_null_literal(lit), TSLiteral::NumericLiteral(lit) => visitor.visit_number_literal(lit), diff --git a/crates/oxc_ast/src/visit/visit_mut.rs b/crates/oxc_ast/src/visit/visit_mut.rs index e39c0aa5e6b3c9..507af2405ced5c 100644 --- a/crates/oxc_ast/src/visit/visit_mut.rs +++ b/crates/oxc_ast/src/visit/visit_mut.rs @@ -1459,7 +1459,7 @@ pub mod walk_mut { pub fn walk_expression_mut<'a, V: VisitMut<'a>>(visitor: &mut V, expr: &mut Expression<'a>) { match expr { - Expression::BigintLiteral(lit) => visitor.visit_bigint_literal(lit), + Expression::BigIntLiteral(lit) => visitor.visit_bigint_literal(lit), Expression::BooleanLiteral(lit) => visitor.visit_boolean_literal(lit), Expression::NullLiteral(lit) => visitor.visit_null_literal(lit), Expression::NumericLiteral(lit) => visitor.visit_number_literal(lit), @@ -2402,7 +2402,7 @@ pub mod walk_mut { visitor: &mut V, _lit: &mut BigIntLiteral<'a>, ) { - let kind = AstType::BigintLiteral; + let kind = AstType::BigIntLiteral; visitor.enter_node(kind); visitor.leave_node(kind); } @@ -3078,7 +3078,7 @@ pub mod walk_mut { let kind = AstType::TSLiteralType; visitor.enter_node(kind); match &mut ty.literal { - TSLiteral::BigintLiteral(lit) => visitor.visit_bigint_literal(lit), + TSLiteral::BigIntLiteral(lit) => visitor.visit_bigint_literal(lit), TSLiteral::BooleanLiteral(lit) => visitor.visit_boolean_literal(lit), TSLiteral::NullLiteral(lit) => visitor.visit_null_literal(lit), TSLiteral::NumericLiteral(lit) => visitor.visit_number_literal(lit), diff --git a/crates/oxc_codegen/src/gen.rs b/crates/oxc_codegen/src/gen.rs index 08536c05ea5b81..2730be555263b5 100644 --- a/crates/oxc_codegen/src/gen.rs +++ b/crates/oxc_codegen/src/gen.rs @@ -1020,7 +1020,7 @@ impl<'a, const MINIFY: bool> GenExpr for Expression<'a> { Self::BooleanLiteral(lit) => lit.gen(p, ctx), Self::NullLiteral(lit) => lit.gen(p, ctx), Self::NumericLiteral(lit) => lit.gen(p, ctx), - Self::BigintLiteral(lit) => lit.gen(p, ctx), + Self::BigIntLiteral(lit) => lit.gen(p, ctx), Self::RegExpLiteral(lit) => lit.gen(p, ctx), Self::StringLiteral(lit) => lit.gen(p, ctx), Self::Identifier(ident) => ident.gen(p, ctx), @@ -2958,7 +2958,7 @@ impl<'a, const MINIFY: bool> Gen for TSLiteral<'a> { Self::BooleanLiteral(decl) => decl.gen(p, ctx), Self::NullLiteral(decl) => decl.gen(p, ctx), Self::NumericLiteral(decl) => decl.gen(p, ctx), - Self::BigintLiteral(decl) => decl.gen(p, ctx), + Self::BigIntLiteral(decl) => decl.gen(p, ctx), Self::RegExpLiteral(decl) => decl.gen(p, ctx), Self::StringLiteral(decl) => decl.gen(p, ctx), Self::TemplateLiteral(decl) => decl.gen(p, ctx), diff --git a/crates/oxc_isolated_declarations/src/class.rs b/crates/oxc_isolated_declarations/src/class.rs index 2a2727d8288bd2..b709f22dd9167f 100644 --- a/crates/oxc_isolated_declarations/src/class.rs +++ b/crates/oxc_isolated_declarations/src/class.rs @@ -17,13 +17,13 @@ impl<'a> IsolatedDeclarations<'a> { match key { PropertyKey::StringLiteral(_) | PropertyKey::NumericLiteral(_) - | PropertyKey::BigintLiteral(_) => true, + | PropertyKey::BigIntLiteral(_) => true, PropertyKey::TemplateLiteral(l) => l.expressions.is_empty(), PropertyKey::UnaryExpression(expr) => { expr.operator.is_arithmetic() && matches!( expr.argument, - Expression::NumericLiteral(_) | Expression::BigintLiteral(_) + Expression::NumericLiteral(_) | Expression::BigIntLiteral(_) ) } _ => false, diff --git a/crates/oxc_isolated_declarations/src/inferrer.rs b/crates/oxc_isolated_declarations/src/inferrer.rs index b631ed334fcaaa..0bab7117ee6953 100644 --- a/crates/oxc_isolated_declarations/src/inferrer.rs +++ b/crates/oxc_isolated_declarations/src/inferrer.rs @@ -19,7 +19,7 @@ impl<'a> IsolatedDeclarations<'a> { Expression::BooleanLiteral(_) => Some(self.ast.ts_boolean_keyword(SPAN)), Expression::NullLiteral(_) => Some(self.ast.ts_null_keyword(SPAN)), Expression::NumericLiteral(_) => Some(self.ast.ts_number_keyword(SPAN)), - Expression::BigintLiteral(_) => Some(self.ast.ts_bigint_keyword(SPAN)), + Expression::BigIntLiteral(_) => Some(self.ast.ts_bigint_keyword(SPAN)), Expression::StringLiteral(_) => Some(self.ast.ts_string_keyword(SPAN)), Expression::TemplateLiteral(lit) => { if lit.expressions.is_empty() { @@ -139,7 +139,7 @@ impl<'a> IsolatedDeclarations<'a> { pub fn is_need_to_infer_type_from_expression(expr: &Expression) -> bool { match expr { Expression::NumericLiteral(_) - | Expression::BigintLiteral(_) + | Expression::BigIntLiteral(_) | Expression::StringLiteral(_) => false, Expression::TemplateLiteral(lit) => !lit.expressions.is_empty(), _ => true, diff --git a/crates/oxc_isolated_declarations/src/types.rs b/crates/oxc_isolated_declarations/src/types.rs index b8fd4a294f0143..ee9cc9860a08d3 100644 --- a/crates/oxc_isolated_declarations/src/types.rs +++ b/crates/oxc_isolated_declarations/src/types.rs @@ -178,8 +178,8 @@ impl<'a> IsolatedDeclarations<'a> { Expression::NumericLiteral(lit) => { Some(self.ast.ts_literal_type(SPAN, TSLiteral::NumericLiteral(self.ast.copy(lit)))) } - Expression::BigintLiteral(lit) => { - Some(self.ast.ts_literal_type(SPAN, TSLiteral::BigintLiteral(self.ast.copy(lit)))) + Expression::BigIntLiteral(lit) => { + Some(self.ast.ts_literal_type(SPAN, TSLiteral::BigIntLiteral(self.ast.copy(lit)))) } Expression::StringLiteral(lit) => { Some(self.ast.ts_literal_type(SPAN, TSLiteral::StringLiteral(self.ast.copy(lit)))) diff --git a/crates/oxc_linter/src/rules/eslint/eqeqeq.rs b/crates/oxc_linter/src/rules/eslint/eqeqeq.rs index d735d91c4a75b1..783c7a5d15b936 100644 --- a/crates/oxc_linter/src/rules/eslint/eqeqeq.rs +++ b/crates/oxc_linter/src/rules/eslint/eqeqeq.rs @@ -193,7 +193,7 @@ fn are_literals_and_same_type(left: &Expression, right: &Expression) -> bool { | (Expression::NullLiteral(_), Expression::NullLiteral(_)) | (Expression::StringLiteral(_), Expression::StringLiteral(_)) | (Expression::NumericLiteral(_), Expression::NumericLiteral(_)) - | (Expression::BigintLiteral(_), Expression::BigintLiteral(_)) + | (Expression::BigIntLiteral(_), Expression::BigIntLiteral(_)) | (Expression::RegExpLiteral(_), Expression::RegExpLiteral(_)) | (Expression::TemplateLiteral(_), Expression::TemplateLiteral(_)) ) diff --git a/crates/oxc_linter/src/rules/eslint/no_compare_neg_zero.rs b/crates/oxc_linter/src/rules/eslint/no_compare_neg_zero.rs index eb1b2da3adb1c0..5690e7ef198e08 100644 --- a/crates/oxc_linter/src/rules/eslint/no_compare_neg_zero.rs +++ b/crates/oxc_linter/src/rules/eslint/no_compare_neg_zero.rs @@ -63,7 +63,7 @@ fn is_neg_zero(expr: &Expression) -> bool { } match &unary.argument { Expression::NumericLiteral(number) => number.value == 0.0, - Expression::BigintLiteral(bigint) => bigint.is_zero(), + Expression::BigIntLiteral(bigint) => bigint.is_zero(), _ => false, } } diff --git a/crates/oxc_linter/src/rules/jest/prefer_to_be.rs b/crates/oxc_linter/src/rules/jest/prefer_to_be.rs index f9ef50eeebc442..814e11685a7431 100644 --- a/crates/oxc_linter/src/rules/jest/prefer_to_be.rs +++ b/crates/oxc_linter/src/rules/jest/prefer_to_be.rs @@ -197,7 +197,7 @@ impl PreferToBe { matches!( expr, - Expression::BigintLiteral(_) + Expression::BigIntLiteral(_) | Expression::BooleanLiteral(_) | Expression::NumericLiteral(_) | Expression::NullLiteral(_) diff --git a/crates/oxc_linter/src/rules/typescript/adjacent_overload_signatures.rs b/crates/oxc_linter/src/rules/typescript/adjacent_overload_signatures.rs index dc6192b98ef0e7..17bdb3c4d53fee 100644 --- a/crates/oxc_linter/src/rules/typescript/adjacent_overload_signatures.rs +++ b/crates/oxc_linter/src/rules/typescript/adjacent_overload_signatures.rs @@ -93,7 +93,7 @@ fn get_kind_from_key(key: &PropertyKey) -> MethodKind { PropertyKey::PrivateIdentifier(_) => MethodKind::Private, PropertyKey::StringLiteral(_) => MethodKind::Normal, PropertyKey::NumericLiteral(_) - | PropertyKey::BigintLiteral(_) + | PropertyKey::BigIntLiteral(_) | PropertyKey::TemplateLiteral(_) | PropertyKey::RegExpLiteral(_) | PropertyKey::NullLiteral(_) => MethodKind::Quoted, diff --git a/crates/oxc_linter/src/rules/unicorn/no_unnecessary_await.rs b/crates/oxc_linter/src/rules/unicorn/no_unnecessary_await.rs index 1ed4cfbc98284c..86cd40763622e3 100644 --- a/crates/oxc_linter/src/rules/unicorn/no_unnecessary_await.rs +++ b/crates/oxc_linter/src/rules/unicorn/no_unnecessary_await.rs @@ -85,7 +85,7 @@ fn not_promise(expr: &Expression) -> bool { | Expression::BooleanLiteral(_) | Expression::NullLiteral(_) | Expression::NumericLiteral(_) - | Expression::BigintLiteral(_) + | Expression::BigIntLiteral(_) | Expression::RegExpLiteral(_) | Expression::StringLiteral(_) | Expression::TemplateLiteral(_) diff --git a/crates/oxc_linter/src/rules/unicorn/number_literal_case.rs b/crates/oxc_linter/src/rules/unicorn/number_literal_case.rs index a5b9eb27cba02a..235fe60dddbc87 100644 --- a/crates/oxc_linter/src/rules/unicorn/number_literal_case.rs +++ b/crates/oxc_linter/src/rules/unicorn/number_literal_case.rs @@ -74,7 +74,7 @@ impl Rule for NumberLiteralCase { fn run<'a>(&self, node: &AstNode<'a>, ctx: &LintContext<'a>) { let (raw_literal, raw_span) = match node.kind() { AstKind::NumericLiteral(number) => (number.raw, number.span), - AstKind::BigintLiteral(number) => { + AstKind::BigIntLiteral(number) => { let span = number.span; (span.source_text(ctx.source_text()), span) } diff --git a/crates/oxc_linter/src/rules/unicorn/numeric_separators_style.rs b/crates/oxc_linter/src/rules/unicorn/numeric_separators_style.rs index 94209acf275987..7fd8e2191b7a4b 100644 --- a/crates/oxc_linter/src/rules/unicorn/numeric_separators_style.rs +++ b/crates/oxc_linter/src/rules/unicorn/numeric_separators_style.rs @@ -101,7 +101,7 @@ impl Rule for NumericSeparatorsStyle { ); } } - AstKind::BigintLiteral(number) => { + AstKind::BigIntLiteral(number) => { let raw = number.span.source_text(ctx.source_text()); if self.only_if_contains_separator && !raw.contains('_') { diff --git a/crates/oxc_minifier/src/compressor/ast_util.rs b/crates/oxc_minifier/src/compressor/ast_util.rs index 6b630262789436..ba10b60412282d 100644 --- a/crates/oxc_minifier/src/compressor/ast_util.rs +++ b/crates/oxc_minifier/src/compressor/ast_util.rs @@ -109,7 +109,7 @@ impl<'a, 'b> CheckForStateChange<'a, 'b> for Expression<'a> { Self::NumericLiteral(_) | Self::BooleanLiteral(_) | Self::StringLiteral(_) - | Self::BigintLiteral(_) + | Self::BigIntLiteral(_) | Self::NullLiteral(_) | Self::RegExpLiteral(_) | Self::MetaProperty(_) @@ -395,7 +395,7 @@ pub fn get_bigint_value(expr: &Expression) -> Option { None } } - Expression::BigintLiteral(_bigint_literal) => { + Expression::BigIntLiteral(_bigint_literal) => { // TODO: evaluate the bigint value None } @@ -473,7 +473,7 @@ pub fn get_boolean_value(expr: &Expression) -> Option { Expression::NullLiteral(_) => Some(false), Expression::BooleanLiteral(boolean_literal) => Some(boolean_literal.value), Expression::NumericLiteral(number_literal) => Some(number_literal.value != 0.0), - Expression::BigintLiteral(big_int_literal) => Some(!big_int_literal.is_zero()), + Expression::BigIntLiteral(big_int_literal) => Some(!big_int_literal.is_zero()), Expression::StringLiteral(string_literal) => Some(!string_literal.value.is_empty()), Expression::TemplateLiteral(template_literal) => { // only for `` @@ -588,7 +588,7 @@ pub fn get_string_value<'a>(expr: &'a Expression) -> Option> { Expression::NumericLiteral(number_literal) => { Some(Cow::Owned(number_literal.value.to_string())) } - Expression::BigintLiteral(big_int_literal) => { + Expression::BigIntLiteral(big_int_literal) => { Some(Cow::Owned(big_int_literal.raw.to_string())) } Expression::NullLiteral(_) => Some(Cow::Borrowed("null")), diff --git a/crates/oxc_minifier/src/compressor/fold.rs b/crates/oxc_minifier/src/compressor/fold.rs index a02537ab4f15cb..4fbd47088fbf8e 100644 --- a/crates/oxc_minifier/src/compressor/fold.rs +++ b/crates/oxc_minifier/src/compressor/fold.rs @@ -125,7 +125,7 @@ impl<'a> From<&Expression<'a>> for Ty { fn from(expr: &Expression<'a>) -> Self { // TODO: complete this match expr { - Expression::BigintLiteral(_) => Self::BigInt, + Expression::BigIntLiteral(_) => Self::BigInt, Expression::BooleanLiteral(_) => Self::Boolean, Expression::NullLiteral(_) => Self::Null, Expression::NumericLiteral(_) => Self::Number, @@ -616,7 +616,7 @@ impl<'a> Compressor<'a> { let bool_literal = self.ast.boolean_literal(unary_expr.span, !boolean); return Some(self.ast.literal_boolean_expression(bool_literal)); } - Expression::BigintLiteral(_) => { + Expression::BigIntLiteral(_) => { let bool_literal = self.ast.boolean_literal(unary_expr.span, !boolean); return Some(self.ast.literal_boolean_expression(bool_literal)); } @@ -676,7 +676,7 @@ impl<'a> Compressor<'a> { ); return Some(self.ast.literal_number_expression(literal)); } - Expression::BigintLiteral(_big_int_literal) => { + Expression::BigIntLiteral(_big_int_literal) => { // let value = big_int_literal.value.clone().neg(); // let literal = // self.ast.bigint_literal(unary_expr.span, value, big_int_literal.base); @@ -706,7 +706,7 @@ impl<'a> Compressor<'a> { return Some(self.ast.literal_number_expression(literal)); } } - Expression::BigintLiteral(_big_int_literal) => { + Expression::BigIntLiteral(_big_int_literal) => { // let value = big_int_literal.value.clone().not(); // let leteral = // self.ast.bigint_literal(unary_expr.span, value, big_int_literal.base); diff --git a/crates/oxc_parser/src/ts/types.rs b/crates/oxc_parser/src/ts/types.rs index c9629d11fc65d3..dc2a39ee210cb7 100644 --- a/crates/oxc_parser/src/ts/types.rs +++ b/crates/oxc_parser/src/ts/types.rs @@ -661,7 +661,7 @@ impl<'a> ParserImpl<'a> { Expression::BooleanLiteral(literal) => TSLiteral::BooleanLiteral(literal), Expression::NullLiteral(literal) => TSLiteral::NullLiteral(literal), Expression::NumericLiteral(literal) => TSLiteral::NumericLiteral(literal), - Expression::BigintLiteral(literal) => TSLiteral::BigintLiteral(literal), + Expression::BigIntLiteral(literal) => TSLiteral::BigIntLiteral(literal), Expression::RegExpLiteral(literal) => TSLiteral::RegExpLiteral(literal), Expression::StringLiteral(literal) => TSLiteral::StringLiteral(literal), Expression::TemplateLiteral(literal) => TSLiteral::TemplateLiteral(literal), diff --git a/crates/oxc_prettier/src/format/mod.rs b/crates/oxc_prettier/src/format/mod.rs index 164e70a8e812e6..b83cb679184db3 100644 --- a/crates/oxc_prettier/src/format/mod.rs +++ b/crates/oxc_prettier/src/format/mod.rs @@ -842,7 +842,7 @@ impl<'a> Format<'a> for TSLiteralType<'a> { TSLiteral::BooleanLiteral(v) => v.format(p), TSLiteral::NullLiteral(v) => v.format(p), TSLiteral::NumericLiteral(v) => v.format(p), - TSLiteral::BigintLiteral(v) => v.format(p), + TSLiteral::BigIntLiteral(v) => v.format(p), TSLiteral::RegExpLiteral(v) => v.format(p), TSLiteral::StringLiteral(v) => v.format(p), TSLiteral::TemplateLiteral(v) => v.format(p), @@ -1250,7 +1250,7 @@ impl<'a> Format<'a> for Expression<'a> { Self::BooleanLiteral(lit) => lit.format(p), Self::NullLiteral(lit) => lit.format(p), Self::NumericLiteral(lit) => lit.format(p), - Self::BigintLiteral(lit) => lit.format(p), + Self::BigIntLiteral(lit) => lit.format(p), Self::RegExpLiteral(lit) => lit.format(p), Self::StringLiteral(lit) => lit.format(p), Self::Identifier(ident) => ident.format(p), diff --git a/crates/oxc_semantic/src/dot.rs b/crates/oxc_semantic/src/dot.rs index d939943b257919..df3354ef781fb4 100644 --- a/crates/oxc_semantic/src/dot.rs +++ b/crates/oxc_semantic/src/dot.rs @@ -35,7 +35,7 @@ impl<'a, 'b> DebugDotContext<'a, 'b> { AstKind::NumericLiteral(lit) => Some(lit.value.to_string()), AstKind::BooleanLiteral(lit) => Some(lit.value.to_string()), AstKind::StringLiteral(lit) => Some(lit.value.to_string()), - AstKind::BigintLiteral(lit) => Some(lit.raw.to_string()), + AstKind::BigIntLiteral(lit) => Some(lit.raw.to_string()), AstKind::NullLiteral(_) => Some("null".to_string()), _ => None, } diff --git a/crates/oxc_traverse/src/walk.rs b/crates/oxc_traverse/src/walk.rs index c53a9771c16735..c77ca99a7ed47f 100644 --- a/crates/oxc_traverse/src/walk.rs +++ b/crates/oxc_traverse/src/walk.rs @@ -77,7 +77,7 @@ pub(crate) unsafe fn walk_expression<'a, Tr: Traverse<'a>>( Expression::NumericLiteral(node) => { walk_numeric_literal(traverser, (&mut **node) as *mut _, ctx) } - Expression::BigintLiteral(node) => { + Expression::BigIntLiteral(node) => { walk_big_int_literal(traverser, (&mut **node) as *mut _, ctx) } Expression::RegExpLiteral(node) => { @@ -264,7 +264,7 @@ pub(crate) unsafe fn walk_array_expression_element<'a, Tr: Traverse<'a>>( ArrayExpressionElement::BooleanLiteral(_) | ArrayExpressionElement::NullLiteral(_) | ArrayExpressionElement::NumericLiteral(_) - | ArrayExpressionElement::BigintLiteral(_) + | ArrayExpressionElement::BigIntLiteral(_) | ArrayExpressionElement::RegExpLiteral(_) | ArrayExpressionElement::StringLiteral(_) | ArrayExpressionElement::TemplateLiteral(_) @@ -398,7 +398,7 @@ pub(crate) unsafe fn walk_property_key<'a, Tr: Traverse<'a>>( PropertyKey::BooleanLiteral(_) | PropertyKey::NullLiteral(_) | PropertyKey::NumericLiteral(_) - | PropertyKey::BigintLiteral(_) + | PropertyKey::BigIntLiteral(_) | PropertyKey::RegExpLiteral(_) | PropertyKey::StringLiteral(_) | PropertyKey::TemplateLiteral(_) @@ -713,7 +713,7 @@ pub(crate) unsafe fn walk_argument<'a, Tr: Traverse<'a>>( Argument::BooleanLiteral(_) | Argument::NullLiteral(_) | Argument::NumericLiteral(_) - | Argument::BigintLiteral(_) + | Argument::BigIntLiteral(_) | Argument::RegExpLiteral(_) | Argument::StringLiteral(_) | Argument::TemplateLiteral(_) @@ -1679,7 +1679,7 @@ pub(crate) unsafe fn walk_for_statement_init<'a, Tr: Traverse<'a>>( ForStatementInit::BooleanLiteral(_) | ForStatementInit::NullLiteral(_) | ForStatementInit::NumericLiteral(_) - | ForStatementInit::BigintLiteral(_) + | ForStatementInit::BigIntLiteral(_) | ForStatementInit::RegExpLiteral(_) | ForStatementInit::StringLiteral(_) | ForStatementInit::TemplateLiteral(_) @@ -3057,7 +3057,7 @@ pub(crate) unsafe fn walk_export_default_declaration_kind<'a, Tr: Traverse<'a>>( ExportDefaultDeclarationKind::BooleanLiteral(_) | ExportDefaultDeclarationKind::NullLiteral(_) | ExportDefaultDeclarationKind::NumericLiteral(_) - | ExportDefaultDeclarationKind::BigintLiteral(_) + | ExportDefaultDeclarationKind::BigIntLiteral(_) | ExportDefaultDeclarationKind::RegExpLiteral(_) | ExportDefaultDeclarationKind::StringLiteral(_) | ExportDefaultDeclarationKind::TemplateLiteral(_) @@ -3336,7 +3336,7 @@ pub(crate) unsafe fn walk_jsx_expression<'a, Tr: Traverse<'a>>( JSXExpression::BooleanLiteral(_) | JSXExpression::NullLiteral(_) | JSXExpression::NumericLiteral(_) - | JSXExpression::BigintLiteral(_) + | JSXExpression::BigIntLiteral(_) | JSXExpression::RegExpLiteral(_) | JSXExpression::StringLiteral(_) | JSXExpression::TemplateLiteral(_) @@ -3693,7 +3693,7 @@ pub(crate) unsafe fn walk_ts_enum_member_name<'a, Tr: Traverse<'a>>( TSEnumMemberName::BooleanLiteral(_) | TSEnumMemberName::NullLiteral(_) | TSEnumMemberName::NumericLiteral(_) - | TSEnumMemberName::BigintLiteral(_) + | TSEnumMemberName::BigIntLiteral(_) | TSEnumMemberName::RegExpLiteral(_) | TSEnumMemberName::StringLiteral(_) | TSEnumMemberName::TemplateLiteral(_) @@ -3786,7 +3786,7 @@ pub(crate) unsafe fn walk_ts_literal<'a, Tr: Traverse<'a>>( TSLiteral::NumericLiteral(node) => { walk_numeric_literal(traverser, (&mut **node) as *mut _, ctx) } - TSLiteral::BigintLiteral(node) => { + TSLiteral::BigIntLiteral(node) => { walk_big_int_literal(traverser, (&mut **node) as *mut _, ctx) } TSLiteral::RegExpLiteral(node) => {