From 76a037ed785148fb271135b5c17c06fd5d036f94 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Thu, 10 Mar 2016 14:50:45 +0800 Subject: Expand - Handle block modules --- src/expand/mod.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/expand') diff --git a/src/expand/mod.cpp b/src/expand/mod.cpp index 5ed91379..dd966545 100644 --- a/src/expand/mod.cpp +++ b/src/expand/mod.cpp @@ -13,6 +13,9 @@ ::std::map< ::std::string, ::std::unique_ptr > g_decorators; ::std::map< ::std::string, ::std::unique_ptr > g_macros; +void Expand_Attrs(const ::AST::MetaItems& attrs, AttrStage stage, ::std::function f); +void Expand_Mod(bool is_early, ::AST::Crate& crate, LList modstack, ::AST::Path modpath, ::AST::Module& mod); + void Register_Synext_Decorator(::std::string name, ::std::unique_ptr handler) { g_decorators[name] = mv$(handler); } @@ -119,11 +122,13 @@ void Expand_Expr(bool is_early, ::AST::Crate& crate, LList m public ::AST::NodeVisitor { bool is_early; + ::AST::Crate& crate; LList modstack; ::std::unique_ptr<::AST::ExprNode> replacement; - CExpandExpr(bool is_early, LList ms): + CExpandExpr(bool is_early, ::AST::Crate& crate, LList ms): is_early(is_early), + crate(crate), modstack(ms) { } @@ -183,6 +188,10 @@ void Expand_Expr(bool is_early, ::AST::Crate& crate, LList m } void visit(::AST::ExprNode_Block& node) override { + // TODO! Use a proper path here + if( node.m_inner_mod ) { + Expand_Mod(is_early, crate, modstack, AST::Path(), *node.m_inner_mod); + } this->visit_vector(node.m_nodes); } void visit(::AST::ExprNode_Flow& node) override { @@ -271,7 +280,7 @@ void Expand_Expr(bool is_early, ::AST::Crate& crate, LList m } }; - auto visitor = CExpandExpr(is_early, modstack); + auto visitor = CExpandExpr(is_early, crate, modstack); node.visit_nodes(visitor); } -- cgit v1.2.3