void (ComprehensionElementVisitor visitor) { ASTNode node = getNode().getFirstChildNode(); while (node != null) { IElementType type = node.getElementType(); ASTNode next = getNextExpression(node); if (next == null) break; if (type == PyTokenTypes.FOR_KEYWORD) { ASTNode next2 = getNextExpression(next); if (next2 == null) break; final PyExpression variable = (PyExpression)next.getPsi(); final PyExpression iterated = (PyExpression)next2.getPsi(); final boolean isAsync = Optional .ofNullable(node.getTreePrev()) .map(ASTNode::getTreePrev) .map(asyncNode -> asyncNode.getElementType() == PyTokenTypes.ASYNC_KEYWORD) .orElse(false); visitor.visitForComponent(new PyComprehensionForComponent() { @Override public PyExpression getIteratorVariable() { return variable; } @Override public PyExpression getIteratedList() { return iterated; } @Override public boolean isAsync() { return isAsync; } }); } else if (type == PyTokenTypes.IF_KEYWORD) { final PyExpression test = (PyExpression)next.getPsi(); visitor.visitIfComponent(new PyComprehensionIfComponent() { @Override public PyExpression getTest() { return test; } }); } node = node.getTreeNext(); } }