]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Add support for unowned/weak array elements
authorFlorian Brosch <flo.brosch@gmail.com>
Sat, 30 Aug 2014 20:35:52 +0000 (22:35 +0200)
committerFlorian Brosch <flo.brosch@gmail.com>
Tue, 2 Sep 2014 17:11:50 +0000 (19:11 +0200)
src/libvaladoc/api/array.vala

index ef2a1d459a8d544c8f5516d3f25d3bbc499767b6..cfbd64291758a76595e5b37644c904993d537954 100644 (file)
@@ -43,13 +43,28 @@ public class Valadoc.Api.Array : Item {
                this.parent = parent;
        }
 
+       private inline bool element_is_owned () {
+               TypeReference reference = data_type as TypeReference;
+               if (reference == null) {
+                       return true;
+               }
+
+               return !reference.is_unowned && !reference.is_weak;
+       }
+
        /**
         * {@inheritDoc}
         */
        protected override Inline build_signature () {
-               return new SignatureBuilder ()
-                       .append_content (data_type.signature)
-                       .append ("[]", false)
-                       .get ();
+               SignatureBuilder builder = new SignatureBuilder ();
+               if (element_is_owned ()) {
+                       builder.append_content (data_type.signature);
+               } else {
+                       builder.append ("(", false);
+                       builder.append_content (data_type.signature, false);
+                       builder.append (")", false);
+               }
+               builder.append ("[]", false);
+               return builder.get ();
        }
 }