Commit 691b97fc authored by Jürg Billeter's avatar Jürg Billeter Committed by Jürg Billeter

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

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

svn path=/trunk/; revision=1772
parent 844770f1
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
2008-09-16 Jürg Billeter <j@bitron.ch>
* gobject/valaccodeinvocationexpressionbinding.vala:
......
......@@ -51,6 +51,7 @@ Rob Taylor
Roberto Majadas
Roland Hostettler
Ross Burton
Sam Liddicott
Samuel Cormier-Iijima
Stéphan Kochen
Tai Chi Minh Ralph Eastwood
......
......@@ -1066,7 +1066,17 @@ public class Vala.CCodeGenerator : CodeGenerator {
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) {
......
......@@ -729,6 +729,10 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
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 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
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) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment