From: Luca Bruno Date: Sun, 2 Feb 2014 19:39:52 +0000 (+0100) Subject: Set the scope of the codebuilder block for symbol resolution X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=93e7cd0e5ab47fe94b3880776557352a6c6878c6;p=thirdparty%2Fvala.git Set the scope of the codebuilder block for symbol resolution --- 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.