diff options
author | Jürg Billeter <j@bitron.ch> | 2010-03-10 17:11:50 +0100 |
---|---|---|
committer | Jürg Billeter <j@bitron.ch> | 2010-03-10 17:11:50 +0100 |
commit | b9ef8541b2a7c2d0966a0dfde53306677089bd4f (patch) | |
tree | 8bce4de45f3a59220e9f8f466678d00f1dbf690e /vala/valaflowanalyzer.vala | |
parent | 9bb99ae85792f22c2a21317f0c0150e81a58f35b (diff) | |
download | vala-b9ef8541b2a7c2d0966a0dfde53306677089bd4f.tar.gz |
Fix flow analysis for catch clauses with specific error types
Diffstat (limited to 'vala/valaflowanalyzer.vala')
-rw-r--r-- | vala/valaflowanalyzer.vala | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/vala/valaflowanalyzer.vala b/vala/valaflowanalyzer.vala index 43baefd4c..a047128cf 100644 --- a/vala/valaflowanalyzer.vala +++ b/vala/valaflowanalyzer.vala @@ -1,6 +1,6 @@ /* valaflowanalyzer.vala * - * Copyright (C) 2008-2009 Jürg Billeter + * Copyright (C) 2008-2010 Jürg Billeter * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -832,10 +832,20 @@ public class Vala.FlowAnalyzer : CodeVisitor { || (jump_target.error_domain == error_type.error_domain && (jump_target.error_code == null || jump_target.error_code == error_type.error_code))) { + // error can always be caught by this catch clause + // following catch clauses cannot be reached by this error current_block.connect (jump_target.basic_block); current_block = null; unreachable_reported = false; break; + } else if (error_type.error_domain == null + || (error_type.error_domain == jump_target.error_domain + && (error_type.error_code == null + || error_type.error_code == jump_target.error_code))) { + // error might be caught by this catch clause + // unknown at compile time + // following catch clauses might still be reached by this error + current_block.connect (jump_target.basic_block); } } else if (jump_target.is_finally_clause) { current_block.connect (jump_target.basic_block); |