[vala/0.52] girparser: Add support for "ref_/ref_sink_/unref_function" metadata for classes



commit 48763857cf244ab214ea672d5b4d5d4d8358ea4e
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Tue Oct 5 15:14:27 2021 +0200

    girparser: Add support for "ref_/ref_sink_/unref_function" metadata for classes
    
    Fixes https://gitlab.gnome.org/GNOME/vala/issues/1233

 vala/valagirparser.vala | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
---
diff --git a/vala/valagirparser.vala b/vala/valagirparser.vala
index 5d0a709b0..098e69a95 100644
--- a/vala/valagirparser.vala
+++ b/vala/valagirparser.vala
@@ -88,6 +88,9 @@ public class Vala.GirParser : CodeVisitor {
                FLOATING,
                TYPE_ID,
                TYPE_GET_FUNCTION,
+               REF_FUNCTION,
+               REF_SINK_FUNCTION,
+               UNREF_FUNCTION,
                RETURN_VOID,
                RETURNS_MODIFIED_POINTER,
                DELEGATE_TARGET_CNAME,
@@ -2995,6 +2998,16 @@ public class Vala.GirParser : CodeVisitor {
 
                cl.access = SymbolAccessibility.PUBLIC;
 
+               if (metadata.has_argument (ArgumentType.REF_FUNCTION)) {
+                       cl.set_attribute_string ("CCode", "ref_function", metadata.get_string 
(ArgumentType.REF_FUNCTION));
+               }
+               if (metadata.has_argument (ArgumentType.REF_SINK_FUNCTION)) {
+                       cl.set_attribute_string ("CCode", "ref_sink_function", metadata.get_string 
(ArgumentType.REF_SINK_FUNCTION));
+               }
+               if (metadata.has_argument (ArgumentType.UNREF_FUNCTION)) {
+                       cl.set_attribute_string ("CCode", "unref_function", metadata.get_string 
(ArgumentType.UNREF_FUNCTION));
+               }
+
                next ();
 
                cl.comment = parse_symbol_doc ();
@@ -3557,6 +3570,15 @@ 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.REF_FUNCTION)) {
+                       cl.set_attribute_string ("CCode", "ref_function", metadata.get_string 
(ArgumentType.REF_FUNCTION));
+               }
+               if (metadata.has_argument (ArgumentType.REF_SINK_FUNCTION)) {
+                       cl.set_attribute_string ("CCode", "ref_sink_function", metadata.get_string 
(ArgumentType.REF_SINK_FUNCTION));
+               }
+               if (metadata.has_argument (ArgumentType.UNREF_FUNCTION)) {
+                       cl.set_attribute_string ("CCode", "unref_function", metadata.get_string 
(ArgumentType.UNREF_FUNCTION));
+               }
 
                next ();
 


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