make macro a NameOwner

This commit is contained in:
Aleksey Kladov
2019-02-11 19:23:13 +03:00
parent e7b370226c
commit 2efdf41bdb
6 changed files with 14 additions and 5 deletions

View File

@@ -1908,6 +1908,7 @@ impl ToOwned for MacroCall {
}
impl ast::NameOwner for MacroCall {}
impl MacroCall {
pub fn token_tree(&self) -> Option<&TokenTree> {
super::child_opt(self)

View File

@@ -545,7 +545,10 @@ Grammar(
"Visibility": (),
"Name": (),
"NameRef": (),
"MacroCall": ( options: [ "TokenTree", "Path" ] ),
"MacroCall": (
traits: [ "NameOwner" ],
options: [ "TokenTree", "Path" ],
),
"Attr": ( options: [ ["value", "TokenTree"] ] ),
"TokenTree": (),
"TypeParamList": (

View File

@@ -347,7 +347,9 @@ fn macro_call(p: &mut Parser) -> BlockLike {
pub(super) fn macro_call_after_excl(p: &mut Parser) -> BlockLike {
p.expect(EXCL);
p.eat(IDENT);
if p.at(IDENT) {
name(p);
}
match p.current() {
L_CURLY => {
token_tree(p);