summaryrefslogtreecommitdiff
path: root/vala/valadelegatetype.vala
diff options
context:
space:
mode:
authorRyan Lortie <desrt@desrt.ca>2011-03-15 22:09:54 +0100
committerJürg Billeter <j@bitron.ch>2011-03-15 22:09:54 +0100
commit31bd6527da6189d72b8b7bc8cbe287c78ba70bfd (patch)
treea11e6dd7fcb0412931afbc4b7e4549586e70148f /vala/valadelegatetype.vala
parentf197d7330bd2c0cf3c8c0b7ce419e411e354aac3 (diff)
downloadvala-31bd6527da6189d72b8b7bc8cbe287c78ba70bfd.tar.gz
Write delegates as qualified types in code writer
Fixes bug 643927.
Diffstat (limited to 'vala/valadelegatetype.vala')
-rw-r--r--vala/valadelegatetype.vala22
1 files changed, 21 insertions, 1 deletions
diff --git a/vala/valadelegatetype.vala b/vala/valadelegatetype.vala
index c5f2ec8e0..da17014ee 100644
--- a/vala/valadelegatetype.vala
+++ b/vala/valadelegatetype.vala
@@ -47,7 +47,27 @@ public class Vala.DelegateType : DataType {
}
public override string to_qualified_string (Scope? scope) {
- string s = delegate_symbol.get_full_name ();
+ // logic temporarily duplicated from DataType class
+
+ Symbol global_symbol = delegate_symbol;
+ while (global_symbol.parent_symbol.name != null) {
+ global_symbol = global_symbol.parent_symbol;
+ }
+
+ Symbol sym = null;
+ Scope parent_scope = scope;
+ while (sym == null && parent_scope != null) {
+ sym = parent_scope.lookup (global_symbol.name);
+ parent_scope = parent_scope.parent_scope;
+ }
+
+ string s;
+
+ if (sym != null && global_symbol != sym) {
+ s = "global::" + delegate_symbol.get_full_name ();;
+ } else {
+ s = delegate_symbol.get_full_name ();
+ }
var type_args = get_type_arguments ();
if (type_args.size > 0) {