]> 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, 28 Feb 2022 11:12:56 +0000 (12:12 +0100)
vala/valagirparser.vala

index 88f38434bc6e5c64fe0fd1742fdf5747ca474926..53d0739265d546ed377e7bc6bfe7adfff1918583 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,
@@ -3615,6 +3617,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));
                }