]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
codegen: Add "destroy_notify_cname" CCode attribute
authorRico Tzschichholz <ricotz@ubuntu.com>
Wed, 6 Jun 2018 15:14:03 +0000 (17:14 +0200)
committerRico Tzschichholz <ricotz@ubuntu.com>
Mon, 14 Jan 2019 13:20:32 +0000 (14:20 +0100)
and the corresponding helper get_delegate_target_destroy_notify_cname()

codegen/valaccode.vala
codegen/valaccodeattribute.vala
vala/valausedattr.vala

index 8e6b6b4a37bb23d33155fed3f7e9c8dfdc49cadb..1fe2a38fce66c13784b6c6bc3b00eef9db0254a2 100644 (file)
@@ -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;
        }
index 1c3665f80142e7c490ab4a6a3094aac8e3026342..defa260f9b68ffd0a8a691d3959f26f2b852eaab 100644 (file)
@@ -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;
index cb003d2e90c7072817212e9f041373fdf9f88720..c4c05cdaaf6ee414e14b79e3f893edd26c2dbf04 100644 (file)
@@ -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", "",