]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
girparser: Add support for "copy_/free_function" metadata for compact classes
authorRico Tzschichholz <ricotz@ubuntu.com>
Mon, 28 Feb 2022 11:12:56 +0000 (12:12 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Mon, 21 Mar 2022 08:06:43 +0000 (09:06 +0100)
vala/valagirparser.vala

index f3435e335955a5d69172493be8dba3a3f18c7a6e..7657bd1a1b91330e98bed27885b96058972ab64d 100644 (file)
@@ -88,6 +88,8 @@ public class Vala.GirParser : CodeVisitor {
                FLOATING,
                TYPE_ID,
                TYPE_GET_FUNCTION,
+               COPY_FUNCTION,
+               FREE_FUNCTION,
                REF_FUNCTION,
                REF_SINK_FUNCTION,
                UNREF_FUNCTION,
@@ -3564,6 +3566,12 @@ public class Vala.GirParser : CodeVisitor {
                if (metadata.has_argument (ArgumentType.BASE_TYPE)) {
                        cl.add_base_type (parse_type_from_string (metadata.get_string (ArgumentType.BASE_TYPE), true, metadata.get_source_reference (ArgumentType.BASE_TYPE)));
                }
+               if (metadata.has_argument (ArgumentType.COPY_FUNCTION)) {
+                       cl.set_attribute_string ("CCode", "copy_function", metadata.get_string (ArgumentType.COPY_FUNCTION));
+               }
+               if (metadata.has_argument (ArgumentType.FREE_FUNCTION)) {
+                       cl.set_attribute_string ("CCode", "free_function", metadata.get_string (ArgumentType.FREE_FUNCTION));
+               }
                if (metadata.has_argument (ArgumentType.REF_FUNCTION)) {
                        cl.set_attribute_string ("CCode", "ref_function", metadata.get_string (ArgumentType.REF_FUNCTION));
                }