]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Make TypeParameter a TypeSymbol to resolve functions with attributes
authorRico Tzschichholz <ricotz@ubuntu.com>
Sun, 18 Apr 2021 19:02:21 +0000 (21:02 +0200)
committerRico Tzschichholz <ricotz@ubuntu.com>
Mon, 19 Apr 2021 06:56:10 +0000 (08:56 +0200)
codegen/valaccodeattribute.vala
vala/valatypeparameter.vala

index 052001aedb48dfab3ef0d7ab7a6b41b3761dda66..d39fc284eb4afa74cd40d3f73d20339889a823d3 100644 (file)
@@ -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 ();
                                }
index 8da52fd672450ab18ed5a3947bf989518358485e..d148d6eebc180e492eb5a7974ec6dd7e39fb2751 100644 (file)
@@ -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.
         *