ASTNode (ASTNode element, boolean expandChameleons) { if (element instanceof LeafElement || !expandChameleons && isCollapsedChameleon(element)) { return element; } for (ASTNode child = element.getLastChildNode(); child != null; child = child.getTreePrev()) { ASTNode leaf = findLastLeaf(child); if (leaf != null) return leaf; } return null; }