summaryrefslogtreecommitdiff
path: root/vala/valacodewriter.vala
diff options
context:
space:
mode:
authorSimon Werbeck <simon.werbeck@gmail.com>2012-03-28 00:59:17 +0200
committerJürg Billeter <j@bitron.ch>2012-07-18 13:07:03 +0200
commitc3a151024ae01f0d79132313e6b0b98f6ccc6205 (patch)
treea8c13524ca47d9a6711d11d8f47aa2115a275cd2 /vala/valacodewriter.vala
parent67ceef2332eecf30a98ddf3033f179bfbfafa6f6 (diff)
downloadvala-c3a151024ae01f0d79132313e6b0b98f6ccc6205.tar.gz
Support 'using' directive with nested namespace in fast-vapi
Fixes bug 672960.
Diffstat (limited to 'vala/valacodewriter.vala')
-rw-r--r--vala/valacodewriter.vala19
1 files changed, 18 insertions, 1 deletions
diff --git a/vala/valacodewriter.vala b/vala/valacodewriter.vala
index f79c2aff2..3986e706f 100644
--- a/vala/valacodewriter.vala
+++ b/vala/valacodewriter.vala
@@ -124,7 +124,24 @@ public class Vala.CodeWriter : CodeVisitor {
public override void visit_using_directive (UsingDirective ns) {
if (type == CodeWriterType.FAST) {
- write_string ("using %s;\n".printf (ns.namespace_symbol.name));
+ write_string ("using ");
+
+ var symbols = new GLib.List<UnresolvedSymbol> ();
+ var sym = (UnresolvedSymbol) ns.namespace_symbol;
+ symbols.prepend (sym);
+
+ while ((sym = sym.inner) != null) {
+ symbols.prepend (sym);
+ }
+
+ write_string (symbols.nth_data (0).name);
+
+ for (int i = 1; i < symbols.length (); i++) {
+ write_string (".");
+ write_string (symbols.nth_data (i).name);
+ }
+
+ write_string (";\n");
}
}