hasEqualChildren method Null safety

  1. @protected
  2. @nonVirtual
bool hasEqualChildren(
  1. covariant Parser other,
  2. Set<Parser> seen
)

Compare the children of two parsers.

Normally this method does not need to be overridden, as this method works generically on the returned Parser.children.

Implementation

@protected
@nonVirtual
bool hasEqualChildren(covariant Parser other, Set<Parser> seen) {
  final thisChildren = children, otherChildren = other.children;
  if (thisChildren.length != otherChildren.length) {
    return false;
  }
  for (var i = 0; i < thisChildren.length; i++) {
    if (!thisChildren[i].isEqualTo(otherChildren[i], seen)) {
      return false;
    }
  }
  return true;
}