PsiStatement (PsiLoopStatement forStatement) { PsiStatement body = forStatement.getBody(); while (body instanceof PsiBlockStatement blockStatement) { final PsiCodeBlock codeBlock = blockStatement.getCodeBlock(); final PsiStatement[] statements = codeBlock.getStatements(); body = statements.length == 0 ? null : statements[0]; } return body; }