Collect tokens for ast::Expr
This commit is contained in:
parent
ff991d6034
commit
14382c6437
16 changed files with 97 additions and 18 deletions
|
@ -272,6 +272,12 @@ pub fn nt_to_tokenstream(nt: &Nonterminal, sess: &ParseSess, span: Span) -> Toke
|
|||
Some(tokenstream::TokenTree::token(token::Lifetime(ident.name), ident.span).into())
|
||||
}
|
||||
Nonterminal::NtTT(ref tt) => Some(tt.clone().into()),
|
||||
Nonterminal::NtExpr(ref expr) => {
|
||||
if expr.tokens.is_none() {
|
||||
debug!("missing tokens for expr {:?}", expr);
|
||||
}
|
||||
prepend_attrs(sess, &expr.attrs, expr.tokens.as_ref(), span)
|
||||
}
|
||||
_ => None,
|
||||
};
|
||||
|
||||
|
@ -311,6 +317,8 @@ pub fn nt_to_tokenstream(nt: &Nonterminal, sess: &ParseSess, span: Span) -> Toke
|
|||
"cached tokens found, but they're not \"probably equal\", \
|
||||
going with stringified version"
|
||||
);
|
||||
info!("cached tokens: {:?}", tokens);
|
||||
info!("reparsed tokens: {:?}", tokens_for_real);
|
||||
}
|
||||
tokens_for_real
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue