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



commit 988ef7ac09ab389e4b38d4589e0966c66ae42992
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 a005efdb0..31b8ad4c6 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,
@@ -2998,6 +3001,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 ();
@@ -3583,6 +3596,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]