From a86ca0b128488d8ec1fedf61977811aaf8b8194b Mon Sep 17 00:00:00 2001 From: overlookmotel <557937+overlookmotel@users.noreply.github.com> Date: Mon, 6 Oct 2025 17:41:51 +0000 Subject: [PATCH] fix(ast): skip `source_text` and `comments` fields in `ContentEq` for `Program` (#14370) `source_text` is not semantically meaningful, and comments is *mostly* not either. Exclude both from `ContentEq` comparison for `Program`. --- crates/oxc_ast/src/ast/js.rs | 2 ++ crates/oxc_ast/src/generated/derive_content_eq.rs | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/oxc_ast/src/ast/js.rs b/crates/oxc_ast/src/ast/js.rs index 9236c93c952e3..b337cdaadf644 100644 --- a/crates/oxc_ast/src/ast/js.rs +++ b/crates/oxc_ast/src/ast/js.rs @@ -50,9 +50,11 @@ use super::{macros::inherit_variants, *}; pub struct Program<'a> { pub span: Span, pub source_type: SourceType, + #[content_eq(skip)] #[estree(skip)] pub source_text: &'a str, /// Sorted comments + #[content_eq(skip)] #[estree(skip)] pub comments: Vec<'a, Comment>, pub hashbang: Option>, diff --git a/crates/oxc_ast/src/generated/derive_content_eq.rs b/crates/oxc_ast/src/generated/derive_content_eq.rs index 19b0ec3aebaca..46652d0c1387f 100644 --- a/crates/oxc_ast/src/generated/derive_content_eq.rs +++ b/crates/oxc_ast/src/generated/derive_content_eq.rs @@ -14,8 +14,6 @@ use crate::ast::ts::*; impl ContentEq for Program<'_> { fn content_eq(&self, other: &Self) -> bool { ContentEq::content_eq(&self.source_type, &other.source_type) - && ContentEq::content_eq(&self.source_text, &other.source_text) - && ContentEq::content_eq(&self.comments, &other.comments) && ContentEq::content_eq(&self.hashbang, &other.hashbang) && ContentEq::content_eq(&self.directives, &other.directives) && ContentEq::content_eq(&self.body, &other.body)