diff options
author | John Hodge <tpg@mutabah.net> | 2016-03-11 23:10:54 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2016-03-11 23:10:54 +0800 |
commit | 990102479e927dd175b2e3ae7aa4c5c1a977d5d1 (patch) | |
tree | e587bdc3c218f784b42e1f20ceaae13575ec8ba2 /src/expand/macro_rules.cpp | |
parent | 76a037ed785148fb271135b5c17c06fd5d036f94 (diff) | |
download | mrust-990102479e927dd175b2e3ae7aa4c5c1a977d5d1.tar.gz |
Expand - Macros expansion improved
Diffstat (limited to 'src/expand/macro_rules.cpp')
-rw-r--r-- | src/expand/macro_rules.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/expand/macro_rules.cpp b/src/expand/macro_rules.cpp index fac987ff..bd9348e5 100644 --- a/src/expand/macro_rules.cpp +++ b/src/expand/macro_rules.cpp @@ -10,14 +10,13 @@ class CMacroRulesExpander: { bool expand_early() const override { return true; } - ::std::unique_ptr<TokenStream> expand(Span sp, const ::std::string& ident, const TokenTree& tt, AST::Module& mod) override + ::std::unique_ptr<TokenStream> expand(Span sp, const ::AST::Crate& crate, const ::std::string& ident, const TokenTree& tt, AST::Module& mod) override { if( ident == "" ) ERROR(sp, E0000, "macro_rules! requires an identifier" ); TTStream lex(tt); auto mac = Parse_MacroRules(lex); - // TODO: Place into current module using `ident` as the name mod.add_macro( false, ident, mac ); return box$( TTStreamO(TokenTree()) ); @@ -29,7 +28,7 @@ class CMacroUseHandler: { AttrStage stage() const override { return AttrStage::EarlyPost; } - void handle(const AST::MetaItem& mi, AST::Crate& crate, const AST::Path& path, AST::Module& mod, AST::Item& i) const override + void handle(const AST::MetaItem& mi, ::AST::Crate& crate, const AST::Path& path, AST::Module& mod, AST::Item& i) const override { TRACE_FUNCTION_F("path=" << path); if( !i.is_Module() ) |