[vala/staging: 5/10] Make TypeParameter a TypeSymbol to resolve functions with attributes




commit b8be96cbccc556e542cf9747ebfcc5ed7d7c4008
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Sun Apr 18 21:02:21 2021 +0200

    Make TypeParameter a TypeSymbol to resolve functions with attributes

 codegen/valaccodeattribute.vala | 9 +++++++++
 vala/valatypeparameter.vala     | 2 +-
 2 files changed, 10 insertions(+), 1 deletion(-)
---
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.
         *


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