diff options
author | John Hodge <tpg@ucc.asn.au> | 2017-05-01 14:14:32 +0800 |
---|---|---|
committer | John Hodge <tpg@ucc.asn.au> | 2017-05-01 14:14:32 +0800 |
commit | 02b79ee261522fc1f1d74dab341c66aa8b634c2d (patch) | |
tree | 66ca392ea3e5185426f67f2f81e8a276f7e14a8b /src/expand | |
parent | 87eb41005024d8855f1d06c2c740e978f42045f7 (diff) | |
download | mrust-02b79ee261522fc1f1d74dab341c66aa8b634c2d.tar.gz |
Expand - Seach anon modules for macros
Diffstat (limited to 'src/expand')
-rw-r--r-- | src/expand/mod.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
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<const ::AST::Module*>(&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) |