From 02b79ee261522fc1f1d74dab341c66aa8b634c2d Mon Sep 17 00:00:00 2001 From: John Hodge Date: Mon, 1 May 2017 14:14:32 +0800 Subject: Expand - Seach anon modules for macros --- src/expand/mod.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src') diff --git a/src/expand/mod.cpp b/src/expand/mod.cpp index b5bbc1a4..e2164a06 100644 --- a/src/expand/mod.cpp +++ b/src/expand/mod.cpp @@ -406,6 +406,12 @@ struct CExpandExpr: void visit(::AST::ExprNode_Block& node) override { unsigned int mod_item_count = 0; + + auto prev_modstack = this->modstack; + if( node.m_local_mod ) { + this->modstack = LList(&prev_modstack, node.m_local_mod.get()); + } + // TODO: macro_rules! invocations within the expression list influence this. // > Solution: Defer creation of the local module until during expand. if( node.m_local_mod ) { @@ -455,6 +461,8 @@ struct CExpandExpr: if( node.m_local_mod ) { Expand_Mod(crate, modstack, node.m_local_mod->path(), *node.m_local_mod, mod_item_count); } + + this->modstack = mv$(prev_modstack); } void visit(::AST::ExprNode_Asm& node) override { for(auto& v : node.m_output) -- cgit v1.2.3