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