[vala/wip/transform-ast: 21/25] Set the scope of the codebuilder block for symbol resolution



commit 93e7cd0e5ab47fe94b3880776557352a6c6878c6
Author: Luca Bruno <lucabru src gnome org>
Date:   Sun Feb 2 20:39:52 2014 +0100

    Set the scope of the codebuilder block for symbol resolution

 vala/valacodebuilder.vala     | 1 +
 vala/valacodetransformer.vala | 4 ++++
 vala/valasymbolresolver.vala  | 2 +-
 3 files changed, 6 insertions(+), 1 deletion(-)
---
diff --git a/vala/valacodebuilder.vala b/vala/valacodebuilder.vala
index bbe8a5cc8..24774e71e 100644
--- a/vala/valacodebuilder.vala
+++ b/vala/valacodebuilder.vala
@@ -35,6 +35,7 @@ public class Vala.CodeBuilder {
                this.source_reference = source_reference;
 
                current_block = new Block (source_reference);
+               current_block.owner = context.analyzer.get_current_symbol (insert_statement).scope;
                insert_block = context.analyzer.get_current_block (insert_statement);
                insert_block.insert_before (insert_statement, current_block);
                this.insert_statement = current_block;
diff --git a/vala/valacodetransformer.vala b/vala/valacodetransformer.vala
index dcf17a5bb..2d6acaccb 100644
--- a/vala/valacodetransformer.vala
+++ b/vala/valacodetransformer.vala
@@ -194,6 +194,10 @@ public class Vala.CodeTransformer : CodeVisitor {
        }
 
        public void check (CodeNode node) {
+               var sym = context.analyzer.get_current_symbol (node);
+               if (sym != null) {
+                       context.resolver.current_scope = sym.scope;
+               }
                node.accept (context.resolver);
                if (!node.check (context)) {
                        return;
diff --git a/vala/valasymbolresolver.vala b/vala/valasymbolresolver.vala
index dbe9b1f21..47d9727d8 100644
--- a/vala/valasymbolresolver.vala
+++ b/vala/valasymbolresolver.vala
@@ -29,7 +29,7 @@ using GLib;
  */
 public class Vala.SymbolResolver : CodeVisitor {
        Symbol root_symbol;
-       Scope current_scope;
+       public Scope current_scope;
 
        /**
         * Resolve symbol names in the specified code context.


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