2008-01-18 Jürg Billeter <j@bitron.ch>
+ * gobject/valaccodegenerator.vala: fix iteration over collections
+ passed by ref parameter using foreach,
+ patch by Hans Vercammen, fixes bug 510419
+
+2008-01-18 Jürg Billeter <j@bitron.ch>
+
* vala/valanulltype.vala, vala/valasemanticanalyzer.vala: simplify
conditional expression type analysis, fixes crash
cblock.add_statement (cfrag);
var collection_backup = stmt.collection_variable_declarator;
- var ccoldecl = new CCodeDeclaration (collection_backup.type_reference.get_cname ());
+ var collection_type = collection_backup.type_reference.copy ();
+ collection_type.is_ref = false;
+ collection_type.is_out = false;
+ var ccoldecl = new CCodeDeclaration (collection_type.get_cname ());
var ccolvardecl = new CCodeVariableDeclarator.with_initializer (collection_backup.name, (CCodeExpression) stmt.collection.ccodenode);
ccolvardecl.line = cblock.line;
ccoldecl.add_declarator (ccolvardecl);
if (array_len is CCodeConstant) {
var it_name = "%s_it".printf (stmt.variable_name);
- var citdecl = new CCodeDeclaration (stmt.collection.static_type.get_cname ());
+ var citdecl = new CCodeDeclaration (collection_type.get_cname ());
citdecl.add_declarator (new CCodeVariableDeclarator (it_name));
cblock.add_statement (citdecl);
stmt.collection.static_type.data_type == gslist_type) {
var it_name = "%s_it".printf (stmt.variable_name);
- var citdecl = new CCodeDeclaration (stmt.collection.static_type.get_cname ());
+ var citdecl = new CCodeDeclaration (collection_type.get_cname ());
var citvardecl = new CCodeVariableDeclarator (it_name);
citvardecl.line = cblock.line;
citdecl.add_declarator (citvardecl);