From: Didier 'Ptitjes Date: Fri, 8 May 2009 16:56:20 +0000 (+0200) Subject: Propagate uncaught errors in try statements X-Git-Tag: 0.7.4~44 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=72bba06647ee22267156fb4f16601aeffa73d0c2;p=thirdparty%2Fvala.git Propagate uncaught errors in try statements Fixes bug 579388. Signed-off-by: Didier 'Ptitjes --- diff --git a/vala/valatrystatement.vala b/vala/valatrystatement.vala index fd43dde5f..715ab7d8d 100644 --- a/vala/valatrystatement.vala +++ b/vala/valatrystatement.vala @@ -96,14 +96,38 @@ public class Vala.TryStatement : CodeNode, Statement { body.check (analyzer); + var error_types = new Gee.ArrayList (); + foreach (DataType body_error_type in body.get_error_types ()) { + error_types.add (body_error_type); + } + + var handled_error_types = new Gee.ArrayList (); foreach (CatchClause clause in catch_clauses) { + foreach (DataType body_error_type in error_types) { + if (body_error_type.compatible (clause.error_type)) { + handled_error_types.add (body_error_type); + } + } + foreach (DataType handled_error_type in handled_error_types) { + error_types.remove (handled_error_type); + } + handled_error_types.clear (); + clause.check (analyzer); + foreach (DataType body_error_type in clause.body.get_error_types ()) { + error_types.add (body_error_type); + } } if (finally_body != null) { finally_body.check (analyzer); + foreach (DataType body_error_type in finally_body.get_error_types ()) { + error_types.add (body_error_type); + } } + add_error_types (error_types); + return !error; } }