[vala/wip/transform: 121/121] Fix foreach on inline allocated arrays
- From: Luca Bruno <lucabru src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/wip/transform: 121/121] Fix foreach on inline allocated arrays
- Date: Tue, 25 Mar 2014 21:02:25 +0000 (UTC)
commit 505904152bbe617ba0ebff159c1dd4dc5bb49289
Author: Luca Bruno <lucabru src gnome org>
Date: Sat Mar 15 11:17:55 2014 +0100
Fix foreach on inline allocated arrays
codegen/valaccodetransformer.vala | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/codegen/valaccodetransformer.vala b/codegen/valaccodetransformer.vala
index 7d8d5e8..0c7d6ef 100644
--- a/codegen/valaccodetransformer.vala
+++ b/codegen/valaccodetransformer.vala
@@ -223,8 +223,14 @@ public class Vala.CCodeTransformer : CodeTransformer {
public override void visit_foreach_statement (ForeachStatement stmt) {
begin_replace_statement (stmt);
-
- var collection = b.add_temp_declaration (stmt.collection.value_type, stmt.collection);
+
+ string collection;
+ var collection_type = copy_type (stmt.collection.value_type);
+ if (collection_type is ArrayType && (((ArrayType) collection_type).inline_allocated)) {
+ collection = stmt.collection.to_string ();
+ } else {
+ collection = b.add_temp_declaration (collection_type, stmt.collection);
+ }
stmt.body.remove_local_variable (stmt.element_variable);
stmt.element_variable.checked = false;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]