From: Jürg Billeter Date: Fri, 7 Nov 2008 09:30:32 +0000 (+0000) Subject: Move throw statement checking to ThrowStatement.check X-Git-Tag: VALA_0_5_2~114 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9aefdf7ab94928f2cd6b4ad65f374f02fff739f4;p=thirdparty%2Fvala.git Move throw statement checking to ThrowStatement.check 2008-11-07 Jürg Billeter * vala/valasemanticanalyzer.vala: * vala/valathrowstatement.vala: Move throw statement checking to ThrowStatement.check svn path=/trunk/; revision=1997 --- diff --git a/ChangeLog b/ChangeLog index 731ed19ac..e2edcebc9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2008-11-07 Jürg Billeter + + * vala/valasemanticanalyzer.vala: + * vala/valathrowstatement.vala: + + Move throw statement checking to ThrowStatement.check + 2008-11-07 Jürg Billeter * vala/valareturnstatement.vala: diff --git a/vala/valasemanticanalyzer.vala b/vala/valasemanticanalyzer.vala index 5a481a962..c19b97549 100644 --- a/vala/valasemanticanalyzer.vala +++ b/vala/valasemanticanalyzer.vala @@ -729,15 +729,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor { } public override void visit_throw_statement (ThrowStatement stmt) { - stmt.error_expression.target_type = new ErrorType (null, null, stmt.source_reference); - stmt.error_expression.target_type.value_owned = true; - - stmt.accept_children (this); - - var error_type = stmt.error_expression.value_type.copy (); - error_type.source_reference = stmt.source_reference; - - stmt.add_error_type (error_type); + stmt.check (this); } public override void visit_try_statement (TryStatement stmt) { diff --git a/vala/valathrowstatement.vala b/vala/valathrowstatement.vala index 867c2780a..d1f8a9f0d 100644 --- a/vala/valathrowstatement.vala +++ b/vala/valathrowstatement.vala @@ -72,4 +72,24 @@ public class Vala.ThrowStatement : CodeNode, Statement { error_expression = new_node; } } + + public override bool check (SemanticAnalyzer analyzer) { + if (checked) { + return !error; + } + + checked = true; + + error_expression.target_type = new ErrorType (null, null, source_reference); + error_expression.target_type.value_owned = true; + + accept_children (analyzer); + + var error_type = error_expression.value_type.copy (); + error_type.source_reference = source_reference; + + add_error_type (error_type); + + return !error; + } }