summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRico Tzschichholz <ricotz@ubuntu.com>2023-04-08 15:50:53 +0200
committerRico Tzschichholz <ricotz@ubuntu.com>2023-04-08 15:50:53 +0200
commit64799db98cde757b73430271cc179bb1838f1ed7 (patch)
tree76593700cbb773a8d7f5d6cbb4ff9c0f8f9928e8
parent84b531ab37e271895f751279c1bbc51b6f2ac393 (diff)
downloadvala-64799db98cde757b73430271cc179bb1838f1ed7.tar.gz
vala: Improve Symbol.to_string() to include TypeParameters
-rw-r--r--vala/valasymbol.vala28
1 files changed, 27 insertions, 1 deletions
diff --git a/vala/valasymbol.vala b/vala/valasymbol.vala
index 7e8b4493a..ebee414ec 100644
--- a/vala/valasymbol.vala
+++ b/vala/valasymbol.vala
@@ -508,7 +508,33 @@ public abstract class Vala.Symbol : CodeNode {
}
public override string to_string () {
- return get_full_name ();
+ var builder = new StringBuilder (get_full_name ());
+
+ unowned List<TypeParameter>? type_params = null;
+ if (this is Delegate) {
+ type_params = ((Delegate) this).get_type_parameters ();
+ } else if (this is Method) {
+ type_params = ((Method) this).get_type_parameters ();
+ } else if (this is ObjectTypeSymbol) {
+ type_params = ((ObjectTypeSymbol) this).get_type_parameters ();
+ } else if (this is Struct) {
+ type_params = ((Struct) this).get_type_parameters ();
+ }
+ if (type_params != null && type_params.size > 0) {
+ builder.append_c ('<');
+ bool first = true;
+ foreach (var type_param in type_params) {
+ if (!first) {
+ builder.append_c (',');
+ } else {
+ first = false;
+ }
+ builder.append (type_param.name);
+ }
+ builder.append_c ('>');
+ }
+
+ return builder.str;
}
}