From d3d58f8acec67d6a26de6664beb4d56c66c268c5 Mon Sep 17 00:00:00 2001 From: overlookmotel <557937+overlookmotel@users.noreply.github.com> Date: Tue, 12 Nov 2024 12:22:20 +0000 Subject: [PATCH] refactor(ast): remove `inherit_variants!` from `TSEnumMemberName` (#7248) #7219 removed all variants of `TSEnumMemberName` except `IdentifierName` and `StringLiteral`. It no longer inherits variants from `Expression`, so we can remove the `inherit_variants!` macro wrapper. The discriminants no longer need to avoid clashes with `Expression`'s, so they can start at 0. --- crates/oxc_ast/src/ast/ts.rs | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/crates/oxc_ast/src/ast/ts.rs b/crates/oxc_ast/src/ast/ts.rs index 208cb6cc24285..fde09f4132ea1 100644 --- a/crates/oxc_ast/src/ast/ts.rs +++ b/crates/oxc_ast/src/ast/ts.rs @@ -102,20 +102,13 @@ pub struct TSEnumMember<'a> { pub initializer: Option>, } -inherit_variants! { /// TS Enum Member Name -/// -/// Used in [`TSEnumMember`]. Inherits variants from [`Expression`]. See [`ast` module docs] for -/// explanation of inheritance. -/// -/// [`ast` module docs]: `super` #[ast(visit)] #[derive(Debug)] #[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)] pub enum TSEnumMemberName<'a> { - StaticIdentifier(Box<'a, IdentifierName<'a>>) = 64, - StaticStringLiteral(Box<'a, StringLiteral<'a>>) = 65, -} + StaticIdentifier(Box<'a, IdentifierName<'a>>) = 0, + StaticStringLiteral(Box<'a, StringLiteral<'a>>) = 1, } /// TypeScript Type Annotation