copy method

Return a deep copy of the node.

Implementation

@override
DartBlockValueTreeBooleanEqualityOperatorNode copy() {
  /// WARNING: do not do parent?.copy().
  /// Reason: This will cause a stackoverflow, as this node already calls its
  /// children's (left & right) copy() methods. If its children call their parent's
  /// (this node)'s copy() again, it will cause an infinite loop.
  /// The correct usage of copy() is to always call it on the root node of the tree,
  /// which will create the deep copy top-down.
  return DartBlockValueTreeBooleanEqualityOperatorNode.init(
    operator,
    leftChild?.copy(),
    rightChild?.copy(),
    parent,
    specificNodeKey: nodeKey,
  );
}