equals method

bool equals(
  1. Object other, [
  2. List<String>? log
])

Compares this node with other. If log is provided, differences are appended in a human-readable format with JSON-style paths.

Implementation

bool equals(Object other, [List<String>? log]) {
  if (identical(this, other)) {
    return true;
  }
  if (other is! SAstNode) {
    log?.add('Type mismatch: $runtimeType != ${other.runtimeType}');
    return false;
  }

  final left = toJson();
  final right = other.toJson();
  return _diffJson(left, right, r'$', log);
}