vala r1772 - in trunk: . gobject vala



Author: juergbi
Date: Tue Sep 16 13:48:51 2008
New Revision: 1772
URL: http://svn.gnome.org/viewvc/vala?rev=1772&view=rev

Log:
2008-09-16  JÃrg Billeter  <j bitron ch>

	* vala/valasemanticanalyzer.vala:
	* gobject/valaccodegenerator.vala:

	Fix error handling in constructors, patch by Jared Moore,
	fixes bug 543156


Modified:
   trunk/ChangeLog
   trunk/THANKS
   trunk/gobject/valaccodegenerator.vala
   trunk/vala/valasemanticanalyzer.vala

Modified: trunk/THANKS
==============================================================================
--- trunk/THANKS	(original)
+++ trunk/THANKS	Tue Sep 16 13:48:51 2008
@@ -51,6 +51,7 @@
 Roberto Majadas
 Roland Hostettler
 Ross Burton
+Sam Liddicott
 Samuel Cormier-Iijima
 StÃphan Kochen
 Tai Chi Minh Ralph Eastwood

Modified: trunk/gobject/valaccodegenerator.vala
==============================================================================
--- trunk/gobject/valaccodegenerator.vala	(original)
+++ trunk/gobject/valaccodegenerator.vala	Tue Sep 16 13:48:51 2008
@@ -1066,7 +1066,17 @@
 
 			source_type_member_declaration.append (base_init.copy ());
 
-			base_init.block = (CCodeBlock) c.body.ccodenode;
+			var block = (CCodeBlock) c.body.ccodenode;
+			if (current_method_inner_error) {
+				/* always separate error parameter and inner_error local variable
+				 * as error may be set to NULL but we're always interested in inner errors
+				 */
+				var cdecl = new CCodeDeclaration ("GError *");
+				cdecl.add_declarator (new CCodeVariableDeclarator.with_initializer ("inner_error", new CCodeConstant ("NULL")));
+				block.prepend_statement (cdecl);
+			}
+
+			base_init.block = block;
 		
 			source_type_member_definition.append (base_init);
 		} else if (c.binding == MemberBinding.STATIC) {

Modified: trunk/vala/valasemanticanalyzer.vala
==============================================================================
--- trunk/vala/valasemanticanalyzer.vala	(original)
+++ trunk/vala/valasemanticanalyzer.vala	Tue Sep 16 13:48:51 2008
@@ -729,6 +729,10 @@
 
 		c.accept_children (this);
 
+		foreach (DataType body_error_type in c.body.get_error_types ()) {
+			Report.warning (body_error_type.source_reference, "unhandled error `%s'".printf (body_error_type.to_string()));
+		}
+
 		current_symbol = current_symbol.parent_symbol;
 	}
 
@@ -1222,6 +1226,11 @@
 		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);
 	}
 
 	public override void visit_try_statement (TryStatement stmt) {



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