Skip to content

Commit

Permalink
Add comments and fix a nit
Browse files Browse the repository at this point in the history
  • Loading branch information
jseyfried committed May 24, 2016
1 parent 3c421ac commit e9c0283
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/libsyntax/ext/expand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,18 @@ use std_inject;
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;
}

Expand Down Expand Up @@ -207,7 +215,7 @@ fn expand_mac_invoc<T>(mac: ast::Mac, ident: Option<Ident>, attrs: Vec<ast::Attr
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() {
Expand Down

0 comments on commit e9c0283

Please sign in to comment.