[vala/staging: 3/4] codegen: Add "destroy_notify_cname" CCode attribute



commit 780ce34ea77989cd05616e775bc681d9acecbd48
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Wed Jun 6 17:14:03 2018 +0200

    codegen: Add "destroy_notify_cname" CCode attribute
    
    and the corresponding helper get_delegate_target_destroy_notify_cname()

 codegen/valaccode.vala          |  4 ++++
 codegen/valaccodeattribute.vala | 15 +++++++++++++++
 vala/valausedattr.vala          |  2 +-
 3 files changed, 20 insertions(+), 1 deletion(-)
---
diff --git a/codegen/valaccode.vala b/codegen/valaccode.vala
index 8e6b6b4a3..1fe2a38fc 100644
--- a/codegen/valaccode.vala
+++ b/codegen/valaccode.vala
@@ -352,6 +352,10 @@ namespace Vala {
                return get_ccode_attribute(variable).delegate_target_name;
        }
 
+       public static string get_ccode_delegate_target_destroy_notify_name (Variable variable) {
+               return get_ccode_attribute(variable).delegate_target_destroy_notify_name;
+       }
+
        public static double get_ccode_pos (Parameter param) {
                return get_ccode_attribute(param).pos;
        }
diff --git a/codegen/valaccodeattribute.vala b/codegen/valaccodeattribute.vala
index 1c3665f80..defa260f9 100644
--- a/codegen/valaccodeattribute.vala
+++ b/codegen/valaccodeattribute.vala
@@ -538,6 +538,20 @@ public class Vala.CCodeAttribute : AttributeCache {
                }
        }
 
+       public string delegate_target_destroy_notify_name {
+               get {
+                       if (_delegate_target_destroy_notify_name == null) {
+                               if (ccode != null) {
+                                       _delegate_target_destroy_notify_name = ccode.get_string 
("destroy_notify_cname");
+                               }
+                               if (_delegate_target_destroy_notify_name == null) {
+                                       _delegate_target_destroy_notify_name = "%s_destroy_notify".printf 
(delegate_target_name);
+                               }
+                       }
+                       return _delegate_target_destroy_notify_name;
+               }
+       }
+
        public bool array_length {
                get {
                        if (_array_length == null) {
@@ -615,6 +629,7 @@ public class Vala.CCodeAttribute : AttributeCache {
        private bool? _finish_instance;
        private string _real_name;
        private string _delegate_target_name;
+       private string _delegate_target_destroy_notify_name;
        private string _ctype;
        private bool ctype_set = false;
        private bool? _array_length;
diff --git a/vala/valausedattr.vala b/vala/valausedattr.vala
index cb003d2e9..c4c05cdaa 100644
--- a/vala/valausedattr.vala
+++ b/vala/valausedattr.vala
@@ -40,7 +40,7 @@ public class Vala.UsedAttr : CodeVisitor {
                "array_length_type", "array_length", "array_length_cname", "array_length_cexpr", 
"array_null_terminated",
                "vfunc_name", "finish_vfunc_name", "finish_name", "free_function_address_of", "pos", 
"delegate_target", "delegate_target_cname",
                "array_length_pos", "delegate_target_pos", "destroy_notify_pos", "ctype", "has_new_function", 
"notify", "finish_instance",
-               "use_inplace", "feature_test_macro", "default_value_on_error", "async_result_pos", 
"error_pos", "",
+               "use_inplace", "feature_test_macro", "default_value_on_error", "async_result_pos", 
"error_pos", "destroy_notify_cname", "",
 
                "Immutable", "",
                "SingleInstance", "",


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