From 425aaf9b20a5888c7d1ba7fbb17f518d6c058604 Mon Sep 17 00:00:00 2001 From: Boshen Date: Fri, 10 Jan 2025 22:27:55 +0800 Subject: [PATCH] feat(ast_tools): ignore `raw` field in `ContentEq` --- crates/oxc_ast/src/generated/derive_content_eq.rs | 9 ++------- tasks/ast_tools/src/derives/content_eq.rs | 3 ++- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/crates/oxc_ast/src/generated/derive_content_eq.rs b/crates/oxc_ast/src/generated/derive_content_eq.rs index 6f0bbbb01ea1bf..0254ce9e544e73 100644 --- a/crates/oxc_ast/src/generated/derive_content_eq.rs +++ b/crates/oxc_ast/src/generated/derive_content_eq.rs @@ -30,7 +30,6 @@ impl ContentEq for NullLiteral { impl ContentEq for NumericLiteral<'_> { fn content_eq(&self, other: &Self) -> bool { ContentEq::content_eq(&self.value, &other.value) - && ContentEq::content_eq(&self.raw, &other.raw) && ContentEq::content_eq(&self.base, &other.base) } } @@ -38,21 +37,18 @@ impl ContentEq for NumericLiteral<'_> { impl ContentEq for StringLiteral<'_> { fn content_eq(&self, other: &Self) -> bool { ContentEq::content_eq(&self.value, &other.value) - && ContentEq::content_eq(&self.raw, &other.raw) } } impl ContentEq for BigIntLiteral<'_> { fn content_eq(&self, other: &Self) -> bool { - ContentEq::content_eq(&self.raw, &other.raw) - && ContentEq::content_eq(&self.base, &other.base) + ContentEq::content_eq(&self.base, &other.base) } } impl ContentEq for RegExpLiteral<'_> { fn content_eq(&self, other: &Self) -> bool { ContentEq::content_eq(&self.regex, &other.regex) - && ContentEq::content_eq(&self.raw, &other.raw) } } @@ -738,8 +734,7 @@ impl ContentEq for TemplateElement<'_> { impl ContentEq for TemplateElementValue<'_> { fn content_eq(&self, other: &Self) -> bool { - ContentEq::content_eq(&self.raw, &other.raw) - && ContentEq::content_eq(&self.cooked, &other.cooked) + ContentEq::content_eq(&self.cooked, &other.cooked) } } diff --git a/tasks/ast_tools/src/derives/content_eq.rs b/tasks/ast_tools/src/derives/content_eq.rs index 496a870403cfde..9357269f7b40a8 100644 --- a/tasks/ast_tools/src/derives/content_eq.rs +++ b/tasks/ast_tools/src/derives/content_eq.rs @@ -13,13 +13,14 @@ pub struct DeriveContentEq; define_derive!(DeriveContentEq); -const IGNORE_FIELDS: [(/* field name */ &str, /* field type */ &str); 6] = [ +const IGNORE_FIELDS: [(/* field name */ &str, /* field type */ &str); 7] = [ ("span", "Span"), ("trailing_comma", "Span"), ("this_span", "Span"), ("scope_id", "ScopeId"), ("symbol_id", "SymbolId"), ("reference_id", "ReferenceId"), + ("raw", "Atom"), ]; impl Derive for DeriveContentEq {