Skip to content

Commit

Permalink
for statements can also definitely return for #891
Browse files Browse the repository at this point in the history
  • Loading branch information
gavinking committed Oct 4, 2015
1 parent 3bf3d55 commit c35310b
Showing 1 changed file with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1738,6 +1738,23 @@ else if (last instanceof Tree.SwitchStatement) {
}
return false;
}
else if (last instanceof Tree.ForStatement) {
Tree.ForStatement is = (Tree.ForStatement) last;
Tree.ElseClause ec = is.getElseClause();
if (ec!=null) {
Tree.Block ecb = ec.getBlock();
if (ecb!=null) {
List<Tree.Statement> ests =
ecb.getStatements();
if (!ests.isEmpty()) {
Tree.Statement elast =
ests.get(ests.size()-1);
return definitelyReturns(elast);
}
}
}
return false;
}
else {
return false;
}
Expand Down

0 comments on commit c35310b

Please sign in to comment.