[vala/wip/transform: 23/31] Resolve symbols during transformation



commit 84a123a4df4ac0700658b40d4b427ec878812303
Author: Luca Bruno <lucabru src gnome org>
Date:   Tue Jan 3 12:37:00 2012 +0100

    Resolve symbols during transformation

 codegen/valagvarianttransformer.vala |    5 ++++-
 vala/valacodetransformer.vala        |    1 +
 vala/valaparser.vala                 |    6 ++++++
 vala/valasymbolresolver.vala         |    2 +-
 4 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/codegen/valagvarianttransformer.vala b/codegen/valagvarianttransformer.vala
index 735779e..4ccd767 100644
--- a/codegen/valagvarianttransformer.vala
+++ b/codegen/valagvarianttransformer.vala
@@ -268,6 +268,9 @@ public class Vala.GVariantTransformer : CodeTransformer {
 				b.add_expression (call);
 			}
 			b.add_return (expression (@"$builder.end ()"));
+
+			b.pop_method ();
+			check (m);
 		}
 
 		var call = (MethodCall) expression (m.name+"()");
@@ -284,7 +287,7 @@ public class Vala.GVariantTransformer : CodeTransformer {
 			var builderinit = expression (@"new GLib.VariantBuilder (new GLib.VariantType (\"$(get_type_signature (type))\"))");
 			var builder = b.add_temp_declaration (null, builderinit);
 
-			var for_each = expression (@"ht.for_each ((k,v) => $builder.add (\"{?*}\", k, v))");
+			var for_each = expression (@"ht.for_each ((k,v) => { GLib.Variant k1 = k; GLib.Variant v1 = v; $builder.add (\"{?*}\", k, v); })");
 			b.add_expression (for_each);
 			b.add_return (expression (@"$builder.end ()"));
 
diff --git a/vala/valacodetransformer.vala b/vala/valacodetransformer.vala
index 857a663..38a793a 100644
--- a/vala/valacodetransformer.vala
+++ b/vala/valacodetransformer.vala
@@ -45,6 +45,7 @@ public class Vala.CodeTransformer : CodeVisitor {
 	}
 
 	public void check (CodeNode node) {
+		node.accept (context.resolver);
 		if (!node.check (context)) {
 			return;
 		}
diff --git a/vala/valaparser.vala b/vala/valaparser.vala
index 8e300b2..68a31a5 100644
--- a/vala/valaparser.vala
+++ b/vala/valaparser.vala
@@ -381,6 +381,12 @@ public class Vala.Parser : CodeVisitor {
 	}
 
 	void skip_symbol_name () throws ParseError {
+		if (compiler_code && accept (TokenType.DOT)) {
+			// temporary variable
+			next ();
+			next ();
+			accept (TokenType.DOT);
+		}
 		do {
 			skip_identifier ();
 		} while (accept (TokenType.DOT) || accept (TokenType.DOUBLE_COLON));
diff --git a/vala/valasymbolresolver.vala b/vala/valasymbolresolver.vala
index f11d74e..5b2ba32 100644
--- a/vala/valasymbolresolver.vala
+++ b/vala/valasymbolresolver.vala
@@ -43,7 +43,7 @@ public class Vala.SymbolResolver : CodeVisitor {
 
 		context.root.accept (this);
 	}
-	
+
 	public override void visit_namespace (Namespace ns) {
 		var old_scope = current_scope;
 		current_scope = ns.scope;



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