if (ifStatement.getExpression() == null) {
return false;
}
GoBlockStatement thenBlock = ifStatement.getThenBlock();
if (thenBlock == null ||
!isNodeOfType(thenBlock.getFirstChild(), GoTokenTypes.pLCURLY) ||
!isNodeOfType(thenBlock.getLastChild(), GoTokenTypes.pRCURLY)) {
return false;
}
GoStatement[] statements = thenBlock.getStatements();
if (statements.length != 1 || !(statements[0] instanceof GoIfStatement)) {
return false;
}
GoIfStatement inner = (GoIfStatement) statements[0];