[vala] Fix C code generated for local string array constants



commit ff4832bf273f8afaa501417d60d2e5c836ad6145
Author: Jürg Billeter <j bitron ch>
Date:   Tue May 21 06:52:02 2013 +0200

    Fix C code generated for local string array constants
    
    Fixes bug 646970.

 vala/valaparser.vala |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/vala/valaparser.vala b/vala/valaparser.vala
index 9f090f3..9ee008b 100644
--- a/vala/valaparser.vala
+++ b/vala/valaparser.vala
@@ -1,6 +1,6 @@
 /* valaparser.vala
  *
- * Copyright (C) 2006-2011  Jürg Billeter
+ * Copyright (C) 2006-2013  Jürg Billeter
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -1751,6 +1751,13 @@ public class Vala.Parser : CodeVisitor {
        void parse_local_constant_declarations (Block block) throws ParseError {
                expect (TokenType.CONST);
                var constant_type = parse_type (false, false);
+
+               // constant arrays don't own their element
+               var array_type = constant_type as ArrayType;
+               if (array_type != null) {
+                       array_type.element_type.value_owned = false;
+               }
+
                do {
                        DataType type_copy = constant_type.copy ();
                        var local = parse_local_constant (type_copy);


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