[vala] Do not check unexpected errors within finally blocks
- From: Jürg Billeter <juergbi src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [vala] Do not check unexpected errors within finally blocks
- Date: Thu, 4 Feb 2010 20:25:38 +0000 (UTC)
commit 79e7b46d393f40dcb753e2a0b36520f4facd5632
Author: Jürg Billeter <j bitron ch>
Date: Thu Feb 4 20:46:02 2010 +0100
Do not check unexpected errors within finally blocks
Jump out of finally block is not supported.
codegen/valagerrormodule.vala | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/codegen/valagerrormodule.vala b/codegen/valagerrormodule.vala
index b00438f..28d23e9 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]