Commit 219f6fce authored by Jürg Billeter's avatar Jürg Billeter Committed by Jürg Billeter

assume that control flow ends when invoking a method with the [NoReturn]

2008-02-05  Juerg Billeter  <j@bitron.ch>

	* vala/valacfgbuilder.vala: assume that control flow ends when
	  invoking a method with the [NoReturn] attribute

	* vapi/glib-2.0.vapi: add [NoReturn] to assert_not_reached

svn path=/trunk/; revision=974
parent 4b24d803
2008-02-05 Jürg Billeter <j@bitron.ch>
* vala/valacfgbuilder.vala: assume that control flow ends when
invoking a method with the [NoReturn] attribute
* vapi/glib-2.0.vapi: add [NoReturn] to assert_not_reached
2008-02-05 Jürg Billeter <j@bitron.ch>
* vala/valasemanticanalyzer.vala: set tree_can_fail for assignments
......
......@@ -166,6 +166,16 @@ public class Vala.CFGBuilder : CodeVisitor {
current_block.add_node (stmt);
handle_errors (stmt);
if (stmt.expression is InvocationExpression) {
var expr = (InvocationExpression) stmt.expression;
var ma = expr.call as MemberAccess;
if (ma.symbol_reference != null && ma.symbol_reference.get_attribute ("NoReturn") != null) {
current_block = null;
unreachable_reported = false;
return;
}
}
}
public override void visit_if_statement (IfStatement! stmt) {
......
......@@ -1395,6 +1395,7 @@ namespace GLib {
public static void return_if_fail (bool expr);
public static void assert (bool expr);
[NoReturn]
public static void assert_not_reached ();
/* Message Logging */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment