Expand NtExpr
tokens only in key-value attributes
This commit is contained in:
parent
338f939a8d
commit
19dbb02a89
18 changed files with 402 additions and 134 deletions
|
@ -20,6 +20,10 @@ use std::mem;
|
|||
struct Marker(ExpnId, Transparency);
|
||||
|
||||
impl MutVisitor for Marker {
|
||||
fn token_visiting_enabled(&self) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn visit_span(&mut self, span: &mut Span) {
|
||||
*span = span.apply_mark(self.0, self.1)
|
||||
}
|
||||
|
@ -277,7 +281,7 @@ pub(super) fn transcribe<'a>(
|
|||
// preserve syntax context.
|
||||
mbe::TokenTree::Token(token) => {
|
||||
let mut tt = TokenTree::Token(token);
|
||||
marker.visit_tt(&mut tt);
|
||||
mut_visit::visit_tt(&mut tt, &mut marker);
|
||||
result.push(tt.into());
|
||||
}
|
||||
|
||||
|
|
|
@ -15,6 +15,9 @@ fn fake_print_crate(s: &mut pprust::State<'_>, krate: &ast::Crate) {
|
|||
struct ToZzIdentMutVisitor;
|
||||
|
||||
impl MutVisitor for ToZzIdentMutVisitor {
|
||||
fn token_visiting_enabled(&self) -> bool {
|
||||
true
|
||||
}
|
||||
fn visit_ident(&mut self, ident: &mut Ident) {
|
||||
*ident = Ident::from_str("zz");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue