compareNodesByOrder static method

int compareNodesByOrder(
  1. AstNode first,
  2. AstNode second
)

Compares two AstNodes by their first position in the query.

Implementation

static int compareNodesByOrder(AstNode first, AstNode second) {
  if (first.first == null || second.first == null) {
    return 0; // position not set. should we throw in that case?
  }
  return first.firstPosition.compareTo(second.firstPosition);
}