use of org.eclipse.n4js.n4JS.Statement in project n4js by eclipse.
the class DeadCodeAnalyser method findPrecedingStatement.
private ControlFlowElement findPrecedingStatement(ControlFlowElement cfe) {
ControlFlowElement precedingStatement = null;
Statement stmt = EcoreUtil2.getContainerOfType(cfe, Statement.class);
if (stmt != null) {
EObject stmtContainer = stmt.eContainer();
if (stmtContainer != null && stmtContainer instanceof Block) {
Block block = (Block) stmtContainer;
EList<Statement> stmts = block.getStatements();
int index = stmts.indexOf(stmt);
if (index > 0) {
precedingStatement = stmts.get(index - 1);
}
}
}
return precedingStatement;
}
Aggregations