Attach tokens to NtMeta
(ast::AttrItem
)
An `AttrItem` does not have outer attributes, so we only capture tokens when parsing a `macro_rules!` matcher
This commit is contained in:
parent
d5a04a9927
commit
3815e91ccd
9 changed files with 17 additions and 6 deletions
|
@ -2419,6 +2419,7 @@ impl<D: Decoder> rustc_serialize::Decodable<D> for AttrId {
|
|||
pub struct AttrItem {
|
||||
pub path: Path,
|
||||
pub args: MacArgs,
|
||||
pub tokens: Option<TokenStream>,
|
||||
}
|
||||
|
||||
/// A list of attributes.
|
||||
|
|
|
@ -330,7 +330,7 @@ crate fn mk_attr_id() -> AttrId {
|
|||
}
|
||||
|
||||
pub fn mk_attr(style: AttrStyle, path: Path, args: MacArgs, span: Span) -> Attribute {
|
||||
mk_attr_from_item(style, AttrItem { path, args }, span)
|
||||
mk_attr_from_item(style, AttrItem { path, args, tokens: None }, span)
|
||||
}
|
||||
|
||||
pub fn mk_attr_from_item(style: AttrStyle, item: AttrItem, span: Span) -> Attribute {
|
||||
|
|
|
@ -579,7 +579,7 @@ pub fn noop_visit_local<T: MutVisitor>(local: &mut P<Local>, vis: &mut T) {
|
|||
pub fn noop_visit_attribute<T: MutVisitor>(attr: &mut Attribute, vis: &mut T) {
|
||||
let Attribute { kind, id: _, style: _, span } = attr;
|
||||
match kind {
|
||||
AttrKind::Normal(AttrItem { path, args }) => {
|
||||
AttrKind::Normal(AttrItem { path, args, tokens: _ }) => {
|
||||
vis.visit_path(path);
|
||||
visit_mac_args(args, vis);
|
||||
}
|
||||
|
@ -709,7 +709,7 @@ pub fn noop_visit_interpolated<T: MutVisitor>(nt: &mut token::Nonterminal, vis:
|
|||
token::NtLifetime(ident) => vis.visit_ident(ident),
|
||||
token::NtLiteral(expr) => vis.visit_expr(expr),
|
||||
token::NtMeta(item) => {
|
||||
let AttrItem { path, args } = item.deref_mut();
|
||||
let AttrItem { path, args, tokens: _ } = item.deref_mut();
|
||||
vis.visit_path(path);
|
||||
visit_mac_args(args, vis);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue