Commit 01702510 authored by Jürg Billeter's avatar Jürg Billeter Committed by Jürg Billeter
Browse files

fix memory management for throw statements, fixes bug 465071

2007-08-20  Juerg Billeter  <j@bitron.ch>

	* vala/valasemanticanalyzer.vala, vala/valathrowstatement.vala,
	  gobject/valacodegenerator.vala: fix memory management for throw
	  statements, fixes bug 465071

svn path=/trunk/; revision=491
parent 62bccb3f
2007-08-20 Jürg Billeter <j@bitron.ch>
* vala/valasemanticanalyzer.vala, vala/valathrowstatement.vala,
gobject/valacodegenerator.vala: fix memory management for throw
statements, fixes bug 465071
2007-08-20 Mathias Hasselmann <mathias.hasselmann@gmx.de>
* tests/test-027.*: Add test for prefix increments
......
......@@ -1787,8 +1787,25 @@ public class Vala.CodeGenerator : CodeVisitor {
var cfrag = new CCodeFragment ();
if (memory_management) {
/* declare temporary objects */
append_temp_decl (cfrag, temp_vars);
}
cfrag.append (new CCodeExpressionStatement ((CCodeExpression) stmt.error_expression.ccodenode));
if (memory_management) {
/* free temporary objects */
foreach (VariableDeclarator decl in temp_ref_vars) {
var ma = new MemberAccess.simple (decl.name);
ma.symbol_reference = decl;
cfrag.append (new CCodeExpressionStatement (get_unref_expression (new CCodeIdentifier (decl.name), decl.type_reference, ma)));
}
}
temp_vars.clear ();
temp_ref_vars.clear ();
if (current_return_type != null && current_return_type.data_type != null) {
cfrag.append (new CCodeReturnStatement (default_value_for_type (current_return_type.data_type)));
} else {
......
......@@ -1853,6 +1853,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
Report.error (expr.source_reference, "Invalid type for argument 1");
}
}
expr.static_type = new TypeReference ();
}
}
......
......@@ -60,8 +60,6 @@ public class Vala.ThrowStatement : CodeNode, Statement {
public override void accept_children (CodeVisitor! visitor) {
if (error_expression != null) {
error_expression.accept (visitor);
visitor.visit_end_full_expression (error_expression);
}
}
......
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