Reformat metadata for exported macros

Instead of copy-pasting the whole macro_rules! item from the original .rs file,
we serialize a separate name, attributes list, and body, the latter as
pretty-printed TTs.  The compilation of macro_rules! macros is decoupled
somewhat from the expansion of macros in item position.

This filters out comments, and facilitates selective imports.
This commit is contained in:
Keegan McAllister 2014-12-30 19:10:46 -08:00
parent 24aa7f0e38
commit 677b7cad3d
12 changed files with 141 additions and 131 deletions

View file

@ -169,6 +169,8 @@ pub fn parse_stmt_from_source_str(name: String,
// Note: keep in sync with `with_hygiene::parse_tts_from_source_str`
// until #16472 is resolved.
//
// Warning: This parses with quote_depth > 0, which is not the default.
pub fn parse_tts_from_source_str(name: String,
source: String,
cfg: ast::CrateConfig,
@ -310,6 +312,8 @@ pub mod with_hygiene {
// Note: keep this in sync with `super::parse_tts_from_source_str` until
// #16472 is resolved.
//
// Warning: This parses with quote_depth > 0, which is not the default.
pub fn parse_tts_from_source_str(name: String,
source: String,
cfg: ast::CrateConfig,