Skip to content

Commit

Permalink
Minor improvement to flow analysis as requested by @kevinvandervlist
Browse files Browse the repository at this point in the history
This is just a trivial fix for the specific case of a while with the
constant `true` as condition. A complete solution would require flow
analysis and constant propagation in the type checker.

We may explore this in the future.
  • Loading branch information
PaulKlint committed Apr 8, 2020
1 parent 4ff4a41 commit fff79a8
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ bool returnsViaAllPath((Statement) `try <Statement body> <Catch+ handlers> final
bool returnsViaAllPath((Statement) `<Label label> while( <{Expression ","}+ conditions> ) <Statement body>`, str fname, Collector c){
returnsViaAllPath(body, fname, c);
return false;
br = returnsViaAllPath(body, fname, c);
return ("<conditions>" == "true") ? br : false;
}
bool returnsViaAllPath((Statement) `<Label label> do <Statement body> while ( <Expression condition> ) ;`, str fname, Collector c){
Expand Down

0 comments on commit fff79a8

Please sign in to comment.