]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Support 'using' directive with nested namespace in fast-vapi
authorSimon Werbeck <simon.werbeck@gmail.com>
Tue, 27 Mar 2012 22:59:17 +0000 (00:59 +0200)
committerJürg Billeter <j@bitron.ch>
Wed, 18 Jul 2012 11:07:03 +0000 (13:07 +0200)
Fixes bug 672960.

vala/valacodewriter.vala

index f79c2aff28e6aa30da6a6ccea53282097076b7e2..3986e706f61519ff33dc6c97b0d74b9f7772e1e6 100644 (file)
@@ -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");
                }
        }