]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
codewriter: Do not write (unowned string)[] for constants
authorLuca Bruno <lucabru@src.gnome.org>
Sat, 28 Jun 2014 08:42:14 +0000 (10:42 +0200)
committerLuca Bruno <lucabru@src.gnome.org>
Sat, 28 Jun 2014 08:45:07 +0000 (10:45 +0200)
The element type of a constant array is forced to be unowned
in the parser. Therefore we don't write (unowned string) to avoid
breaking vapi parsing uselessly with older valac versions.

Fixes bug 732080

vala/valaarraytype.vala

index caab109cbf830ac3dd2123b4f5a0e453a0115301..8ba11985320d99463e29e4971ee5b5698284979d 100644 (file)
@@ -166,7 +166,7 @@ public class Vala.ArrayType : ReferenceType {
 
        public override string to_qualified_string (Scope? scope) {
                var elem_str = element_type.to_qualified_string (scope);
-               if (element_type.is_weak ()) {
+               if (element_type.is_weak () && !(element_type.parent_node is Constant)) {
                        elem_str = "(unowned %s)".printf (elem_str);
                }