[vala] Support 'using' directive with nested namespace in fast-vapi



commit c3a151024ae01f0d79132313e6b0b98f6ccc6205
Author: Simon Werbeck <simon werbeck gmail com>
Date:   Wed Mar 28 00:59:17 2012 +0200

    Support 'using' directive with nested namespace in fast-vapi
    
    Fixes bug 672960.

 vala/valacodewriter.vala |   19 ++++++++++++++++++-
 1 files changed, 18 insertions(+), 1 deletions(-)
---
diff --git a/vala/valacodewriter.vala b/vala/valacodewriter.vala
index f79c2af..3986e70 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");
 		}
 	}
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]