Allow selective macro import

This commit is contained in:
Keegan McAllister
2015-01-02 12:50:45 -08:00
parent 0816255c80
commit aa69cbde82
19 changed files with 299 additions and 8 deletions

View File

@@ -574,8 +574,10 @@ impl<'a> ExtCtxt<'a> {
if def.export {
self.exported_macros.push(def.clone());
}
let ext = macro_rules::compile(self, &def);
self.syntax_env.insert(def.ident.name, ext);
if def.use_locally {
let ext = macro_rules::compile(self, &def);
self.syntax_env.insert(def.ident.name, ext);
}
}
/// Emit `msg` attached to `sp`, and stop compilation immediately.