vala r1997 - in trunk: . vala



Author: juergbi
Date: Fri Nov  7 09:30:32 2008
New Revision: 1997
URL: http://svn.gnome.org/viewvc/vala?rev=1997&view=rev

Log:
2008-11-07  JÃrg Billeter  <j bitron ch>

	* vala/valasemanticanalyzer.vala:
	* vala/valathrowstatement.vala:

	Move throw statement checking to ThrowStatement.check


Modified:
   trunk/ChangeLog
   trunk/vala/valasemanticanalyzer.vala
   trunk/vala/valathrowstatement.vala

Modified: trunk/vala/valasemanticanalyzer.vala
==============================================================================
--- trunk/vala/valasemanticanalyzer.vala	(original)
+++ trunk/vala/valasemanticanalyzer.vala	Fri Nov  7 09:30:32 2008
@@ -729,15 +729,7 @@
 	}
 
 	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) {

Modified: trunk/vala/valathrowstatement.vala
==============================================================================
--- trunk/vala/valathrowstatement.vala	(original)
+++ trunk/vala/valathrowstatement.vala	Fri Nov  7 09:30:32 2008
@@ -72,4 +72,24 @@
 			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;
+	}
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]