From: Rico Tzschichholz Date: Wed, 6 Jun 2018 15:14:03 +0000 (+0200) Subject: codegen: Add "destroy_notify_cname" CCode attribute X-Git-Tag: 0.43.5~19 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=780ce34ea77989cd05616e775bc681d9acecbd48;p=thirdparty%2Fvala.git codegen: Add "destroy_notify_cname" CCode attribute and the corresponding helper get_delegate_target_destroy_notify_cname() --- 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", "",