Use this control flow information in codegen rather than doing an
educated guess based on occurring ReturnStatement nodes.
See https://gitlab.gnome.org/GNOME/vala/issues/838
cfile.add_function (unref_fun);
}
- bool reachable_exit_block = true;
foreach (Statement stmt in b.get_statements ()) {
- if (stmt is ReturnStatement) {
- reachable_exit_block = false;
- }
push_line (stmt.source_reference);
stmt.emit (this);
pop_line ();
}
- if (reachable_exit_block) {
+ if (!b.unreachable_exit) {
if (b.parent_symbol is Method) {
unowned Method m = (Method) b.parent_symbol;
// check postconditions
*/
public bool contains_jump_statement { get; set; }
+ /**
+ * Specifies whether the end of this block is unreachable.
+ */
+ public bool unreachable_exit { get; set; }
+
public bool captured { get; set; }
private List<Statement> statement_list = new ArrayList<Statement> ();
}
current_block.connect (m.return_block);
+ } else {
+ m.body.unreachable_exit = true;
}
analyze_body (m.entry_block);