boolean (ASTNode prevLeaf, ASTNode first) { while (first != null) { ASTNode current = prevLeaf; while (current != null) { if (current.getTreeNext() == first) return true; current = current.getTreeParent(); } ASTNode parent = first.getTreeParent(); if (parent != null && parent.getTextRange().equals(first.getTextRange())) { first = parent; } else { break; } } return false; }