From: Rico Tzschichholz Date: Sun, 18 Apr 2021 19:02:21 +0000 (+0200) Subject: Make TypeParameter a TypeSymbol to resolve functions with attributes X-Git-Tag: 0.53.1~105 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b8be96cbccc556e542cf9747ebfcc5ed7d7c4008;p=thirdparty%2Fvala.git Make TypeParameter a TypeSymbol to resolve functions with attributes --- diff --git a/codegen/valaccodeattribute.vala b/codegen/valaccodeattribute.vala index 052001aed..d39fc284e 100644 --- a/codegen/valaccodeattribute.vala +++ b/codegen/valaccodeattribute.vala @@ -222,6 +222,9 @@ public class Vala.CCodeAttribute : AttributeCache { if (_copy_function == null && sym is Struct) { _copy_function = "%scopy".printf (lower_case_prefix); } + if (_copy_function == null && sym is TypeParameter) { + _copy_function = "%s_dup_func".printf (sym.name.ascii_down ()); + } copy_function_set = true; } return _copy_function; @@ -237,6 +240,9 @@ public class Vala.CCodeAttribute : AttributeCache { if (_destroy_function == null && sym is Struct) { _destroy_function = "%sdestroy".printf (lower_case_prefix); } + if (_destroy_function == null && sym is TypeParameter) { + _destroy_function = "%s_destroy_func".printf (sym.name.ascii_down ()); + } destroy_function_set = true; } return _destroy_function; @@ -315,6 +321,9 @@ public class Vala.CCodeAttribute : AttributeCache { if (ccode != null) { _type_id = ccode.get_string ("type_id"); } + if (_type_id == null && sym is TypeParameter) { + _type_id = "%s_type".printf (sym.name.ascii_down ()); + } if (_type_id == null) { _type_id = get_default_type_id (); } diff --git a/vala/valatypeparameter.vala b/vala/valatypeparameter.vala index 8da52fd67..d148d6eeb 100644 --- a/vala/valatypeparameter.vala +++ b/vala/valatypeparameter.vala @@ -25,7 +25,7 @@ using GLib; /** * Represents a generic type parameter in the source code. */ -public class Vala.TypeParameter : Symbol { +public class Vala.TypeParameter : TypeSymbol { /** * Creates a new generic type parameter. *