Skip to content

Commit a86ca0b

Browse files
committed
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`.
1 parent 4bf6f69 commit a86ca0b

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

crates/oxc_ast/src/ast/js.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,11 @@ use super::{macros::inherit_variants, *};
5050
pub struct Program<'a> {
5151
pub span: Span,
5252
pub source_type: SourceType,
53+
#[content_eq(skip)]
5354
#[estree(skip)]
5455
pub source_text: &'a str,
5556
/// Sorted comments
57+
#[content_eq(skip)]
5658
#[estree(skip)]
5759
pub comments: Vec<'a, Comment>,
5860
pub hashbang: Option<Hashbang<'a>>,

crates/oxc_ast/src/generated/derive_content_eq.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ use crate::ast::ts::*;
1414
impl ContentEq for Program<'_> {
1515
fn content_eq(&self, other: &Self) -> bool {
1616
ContentEq::content_eq(&self.source_type, &other.source_type)
17-
&& ContentEq::content_eq(&self.source_text, &other.source_text)
18-
&& ContentEq::content_eq(&self.comments, &other.comments)
1917
&& ContentEq::content_eq(&self.hashbang, &other.hashbang)
2018
&& ContentEq::content_eq(&self.directives, &other.directives)
2119
&& ContentEq::content_eq(&self.body, &other.body)

0 commit comments

Comments
 (0)