syntax: Capture a TokenStream
when parsing items
This is then later used by `proc_macro` to generate a new `proc_macro::TokenTree` which preserves span information. Unfortunately this isn't a bullet-proof approach as it doesn't handle the case when there's still other attributes on the item, especially inner attributes. Despite this the intention here is to solve the primary use case for procedural attributes, attached to functions as outer attributes, likely bare. In this situation we should be able to now yield a lossless stream of tokens to preserve span information.
This commit is contained in:
parent
036300aadd
commit
4886ec8665
10 changed files with 399 additions and 21 deletions
|
@ -504,6 +504,7 @@ impl<'a> TraitDef<'a> {
|
|||
defaultness: ast::Defaultness::Final,
|
||||
attrs: Vec::new(),
|
||||
node: ast::ImplItemKind::Type(type_def.to_ty(cx, self.span, type_ident, generics)),
|
||||
tokens: None,
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -930,6 +931,7 @@ impl<'a> MethodDef<'a> {
|
|||
decl: fn_decl,
|
||||
},
|
||||
body_block),
|
||||
tokens: None,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue