]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
UnresolvedType: Improve .to_string()
authorRyan Lortie <desrt@desrt.ca>
Tue, 24 Aug 2010 17:24:58 +0000 (19:24 +0200)
committerJürg Billeter <j@bitron.ch>
Fri, 17 Sep 2010 23:00:13 +0000 (01:00 +0200)
Include nullable designation and generic type arguments in the output.

vala/valaunresolvedtype.vala

index f9355f6f156de32d57d2363f3b3b9ea1e67afcff..201fd61d79d716bfe42f5a507f460c937d161d84 100644 (file)
@@ -87,6 +87,29 @@ public class Vala.UnresolvedType : DataType {
        }
 
        public override string to_qualified_string (Scope? scope) {
-               return unresolved_symbol.to_string ();
+               var s = unresolved_symbol.to_string ();
+
+               var type_args = get_type_arguments ();
+               if (type_args.size > 0) {
+                       s += "<";
+                       bool first = true;
+                       foreach (DataType type_arg in type_args) {
+                               if (!first) {
+                                       s += ",";
+                               } else {
+                                       first = false;
+                               }
+                               if (!type_arg.value_owned) {
+                                       s += "weak ";
+                               }
+                               s += type_arg.to_qualified_string (scope);
+                       }
+                       s += ">";
+               }
+               if (nullable) {
+                       s += "?";
+               }
+
+               return s;
        }
 }