Add comments and fix a nit

This commit is contained in:
Jeffrey Seyfried 2016-05-24 06:12:54 +00:00
parent 3c421ac67e
commit e9c0283369

View File

@ -35,10 +35,18 @@
use std::collections::HashSet;
use std::env;
// A trait for AST nodes and AST node lists into which macro invocations may expand.
trait MacroGenerable: Sized {
// Expand the given MacResult using its appropriate `make_*` method.
fn make_with<'a>(result: Box<MacResult + 'a>) -> Option<Self>;
// Fold this node or list of nodes using the given folder.
fn fold_with<F: Folder>(self, folder: &mut F) -> Self;
// Return a placeholder expansion to allow compilation to continue after an erroring expansion.
fn dummy(span: Span) -> Self;
// The user-friendly name of the node type (e.g. "expression", "item", etc.) for diagnostics.
fn kind_name() -> &'static str;
}
@ -207,7 +215,7 @@ fn mac_result<'a>(path: &ast::Path, ident: Option<Ident>, tts: Vec<TokenTree>, m
return None;
};
let ident = ident.unwrap_or(Ident::with_empty_ctxt(keywords::Invalid.name()));
let ident = ident.unwrap_or(keywords::Invalid.ident());
match *extension {
NormalTT(ref expandfun, exp_span, allow_internal_unstable) => {
if ident.name != keywords::Invalid.name() {