Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ast_tools): ignore raw field of NumericLiteral and StringLiteral in ContentEq #8417

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions crates/oxc_ast/src/generated/derive_content_eq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,13 @@ 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)
}
}

Expand Down
4 changes: 4 additions & 0 deletions tasks/ast_tools/src/derives/content_eq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ fn derive_struct(def: &StructDef) -> (&str, TokenStream) {
.iter()
.filter(|field| {
let Some(name) = field.name.as_ref() else { return false };
if name == "raw" && matches!(def.name.as_str(), "NumericLiteral" | "StringLiteral")
{
return false;
}
!IGNORE_FIELDS
.iter()
.any(|it| name == it.0 && field.typ.name().inner_name() == it.1)
Expand Down
Loading