From: Jürg Billeter Date: Thu, 4 Feb 2010 19:46:02 +0000 (+0100) Subject: Do not check unexpected errors within finally blocks X-Git-Tag: 0.7.10~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=79e7b46d393f40dcb753e2a0b36520f4facd5632;p=thirdparty%2Fvala.git Do not check unexpected errors within finally blocks Jump out of finally block is not supported. --- diff --git a/codegen/valagerrormodule.vala b/codegen/valagerrormodule.vala index b00438f12..28d23e9a6 100644 --- a/codegen/valagerrormodule.vala +++ b/codegen/valagerrormodule.vala @@ -176,6 +176,18 @@ internal class Vala.GErrorModule : CCodeDelegateModule { return cerror_block; } + bool in_finally_block (CodeNode node) { + var current_node = node; + while (current_node != null) { + var try_stmt = current_node.parent_node as TryStatement; + if (try_stmt != null && try_stmt.finally_body == current_node) { + return true; + } + current_node = current_node.parent_node; + } + return false; + } + public override void add_simple_check (CodeNode node, CCodeFragment cfrag) { current_method_inner_error = true; @@ -247,6 +259,9 @@ internal class Vala.GErrorModule : CCodeDelegateModule { // go to finally clause if no catch clause matches // and there are still unhandled error types cerror_block.add_statement (new CCodeGotoStatement ("__finally%d".printf (current_try_id))); + } else if (in_finally_block (node)) { + // do not check unexpected errors happening within finally blocks + // as jump out of finally block is not supported } else { // should never happen with correct bindings uncaught_error_statement (inner_error, cerror_block, true);