int (@NotNull ASTNode node, @NotNull IElementType elementType) { // no lock is needed because all chameleons are expanded already int count = 0; for (ASTNode child = node.getFirstChildNode(); child != null; child = child.getTreeNext()) { if (child.getElementType() == elementType) { count++; } } return count; }