equals method
Structural equality.
When ignoreSpans is true (the default), two ASTs from differently-
positioned sources compare equal as long as their structure matches —
useful for testing parser output against expected shapes regardless
of whitespace placement. Set false for a strict, position-aware
comparison that requires every Span to match.
Implementation
@override
bool equals(FluentNode other, {bool ignoreSpans = true}) {
if (other is! Term) return false;
if (!id.equals(other.id, ignoreSpans: ignoreSpans)) return false;
if (!value.equals(other.value, ignoreSpans: ignoreSpans)) return false;
if (attributes.length != other.attributes.length) return false;
for (var i = 0; i < attributes.length; i++) {
if (!attributes[i].equals(
other.attributes[i],
ignoreSpans: ignoreSpans,
)) {
return false;
}
}
if ((comment == null) != (other.comment == null)) return false;
if (comment != null &&
!comment!.equals(other.comment!, ignoreSpans: ignoreSpans)) {
return false;
}
return _spansEqual(span, other.span, ignoreSpans: ignoreSpans);
}