diff options
author | Ryan Lortie <desrt@desrt.ca> | 2011-03-15 22:09:54 +0100 |
---|---|---|
committer | Jürg Billeter <j@bitron.ch> | 2011-03-15 22:09:54 +0100 |
commit | 31bd6527da6189d72b8b7bc8cbe287c78ba70bfd (patch) | |
tree | a11e6dd7fcb0412931afbc4b7e4549586e70148f /vala/valadelegatetype.vala | |
parent | f197d7330bd2c0cf3c8c0b7ce419e411e354aac3 (diff) | |
download | vala-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.vala | 22 |
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) { |