Skip to content

Commit

Permalink
feat(ast_tools): ignore raw field in ContentEq
Browse files Browse the repository at this point in the history
  • Loading branch information
Boshen committed Jan 10, 2025
1 parent 357b61d commit 425aaf9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
9 changes: 2 additions & 7 deletions crates/oxc_ast/src/generated/derive_content_eq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,29 +30,25 @@ 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)
}
}

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)
}
}

Expand Down Expand Up @@ -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)
}
}

Expand Down
3 changes: 2 additions & 1 deletion tasks/ast_tools/src/derives/content_eq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 425aaf9

Please sign in to comment.