equals method

  1. @override
bool equals(
  1. FluentNode other, {
  2. bool ignoreSpans = true,
})
override

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! SelectExpression) return false;
  if (!selector.equals(other.selector, ignoreSpans: ignoreSpans)) {
    return false;
  }
  if (variants.length != other.variants.length) return false;
  for (var i = 0; i < variants.length; i++) {
    if (!variants[i].equals(other.variants[i], ignoreSpans: ignoreSpans)) {
      return false;
    }
  }
  return _spansEqual(span, other.span, ignoreSpans: ignoreSpans);
}