expand macro invocations in extern {} blocks

This commit is contained in:
Austin Bonander
2018-03-10 18:16:26 -08:00
parent 5ee891cfea
commit 5d74990ceb
31 changed files with 544 additions and 65 deletions

View File

@@ -281,6 +281,7 @@ pub fn token_to_string(tok: &Token) -> String {
token::NtArg(ref e) => arg_to_string(e),
token::NtVis(ref e) => vis_to_string(e),
token::NtLifetime(ref e) => lifetime_to_string(e),
token::NtForeignItem(ref ni) => foreign_item_to_string(ni),
}
}
}
@@ -422,6 +423,10 @@ pub fn mac_to_string(arg: &ast::Mac) -> String {
to_string(|s| s.print_mac(arg, ::parse::token::Paren))
}
pub fn foreign_item_to_string(arg: &ast::ForeignItem) -> String {
to_string(|s| s.print_foreign_item(arg))
}
pub fn visibility_qualified(vis: &ast::Visibility, s: &str) -> String {
format!("{}{}", to_string(|s| s.print_visibility(vis)), s)
}
@@ -1127,6 +1132,10 @@ impl<'a> State<'a> {
self.end()?; // end the head-ibox
self.end() // end the outer cbox
}
ast::ForeignItemKind::Macro(ref m) => {
self.print_mac(m, token::Paren)?;
self.s.word(";")
}
}
}