[vala/wip/transform: 24/99] Resolve symbols during transformation



commit 829baa3ebf6f67bd03aa2ba18f167f138852bcb7
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 8583c10..b10416a 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 9cc6f71..8631c37 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 94858e3..4fbe850 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]