summaryrefslogtreecommitdiff
path: root/src/expand
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2016-04-02 12:32:36 +0800
committerJohn Hodge <tpg@mutabah.net>2016-04-02 12:32:36 +0800
commit3ac89867ceb4474c3be9794348d7bd5183305cfb (patch)
treea9a1b4631c015c3d492643955ba1c7a5cbe183d0 /src/expand
parent23b9d62d2adf8eb272aea3ce7ca63380873931fc (diff)
downloadmrust-3ac89867ceb4474c3be9794348d7bd5183305cfb.tar.gz
Expand - Handle attributes on module-level macro invocations
Diffstat (limited to 'src/expand')
-rw-r--r--src/expand/mod.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/expand/mod.cpp b/src/expand/mod.cpp
index cfbfc2e7..416db81e 100644
--- a/src/expand/mod.cpp
+++ b/src/expand/mod.cpp
@@ -25,6 +25,12 @@ void Register_Synext_Macro(::std::string name, ::std::unique_ptr<ExpandProcMacro
g_macros[name] = mv$(handler);
}
+
+void ExpandDecorator::unexpected(const AST::MetaItem& mi, const char* loc_str) const
+{
+ ERROR(Span(), E0000, "Unexpected attribute " << mi.name() << " on " << loc_str);
+}
+
namespace {
AttrStage stage_pre(bool is_early) {
return (is_early ? AttrStage::EarlyPre : AttrStage::LatePre);
@@ -459,14 +465,14 @@ void Expand_Mod(bool is_early, ::AST::Crate& crate, LList<const AST::Module*> mo
for(unsigned int i = 0; i < mod.macro_invs().size(); i ++ )
{
auto& mi = mod.macro_invs()[i];
- DEBUG("> Macro invoke '"<<mi.name()<<"'");
+ DEBUG("> Macro invoke " << mi);
if( mi.name() != "" )
{
// Move out of the module to avoid invalidation if a new macro invocation is added
auto mi_owned = mv$(mi);
- auto& attrs = mi.attrs();
+ auto& attrs = mi_owned.attrs();
Expand_Attrs(attrs, stage_pre(is_early), [&](const auto& d, const auto& a){ d.handle(a, crate, mi_owned); });
auto ttl = Expand_Macro(is_early, crate, modstack, mod, mi_owned);