diff options
Diffstat (limited to 'crates/ra_syntax')
-rw-r--r-- | crates/ra_syntax/src/ast.rs | 9 | ||||
-rw-r--r-- | crates/ra_syntax/src/ast/generated.rs | 1 | ||||
-rw-r--r-- | crates/ra_syntax/src/grammar.ron | 2 |
3 files changed, 5 insertions, 7 deletions
diff --git a/crates/ra_syntax/src/ast.rs b/crates/ra_syntax/src/ast.rs index 81c709bfb..d8c2cb063 100644 --- a/crates/ra_syntax/src/ast.rs +++ b/crates/ra_syntax/src/ast.rs | |||
@@ -114,6 +114,9 @@ pub trait AttrsOwner: AstNode { | |||
114 | fn attrs(&self) -> AstChildren<Attr> { | 114 | fn attrs(&self) -> AstChildren<Attr> { |
115 | children(self) | 115 | children(self) |
116 | } | 116 | } |
117 | fn has_atom_attr(&self, atom: &str) -> bool { | ||
118 | self.attrs().filter_map(|x| x.as_atom()).any(|x| x == atom) | ||
119 | } | ||
117 | } | 120 | } |
118 | 121 | ||
119 | pub trait DocCommentsOwner: AstNode { | 122 | pub trait DocCommentsOwner: AstNode { |
@@ -153,12 +156,6 @@ pub trait DocCommentsOwner: AstNode { | |||
153 | } | 156 | } |
154 | } | 157 | } |
155 | 158 | ||
156 | impl FnDef { | ||
157 | pub fn has_atom_attr(&self, atom: &str) -> bool { | ||
158 | self.attrs().filter_map(|x| x.as_atom()).any(|x| x == atom) | ||
159 | } | ||
160 | } | ||
161 | |||
162 | impl Attr { | 159 | impl Attr { |
163 | pub fn is_inner(&self) -> bool { | 160 | pub fn is_inner(&self) -> bool { |
164 | let tt = match self.value() { | 161 | let tt = match self.value() { |
diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs index 7572225b8..54b72f8c5 100644 --- a/crates/ra_syntax/src/ast/generated.rs +++ b/crates/ra_syntax/src/ast/generated.rs | |||
@@ -2108,6 +2108,7 @@ impl ToOwned for MacroCall { | |||
2108 | 2108 | ||
2109 | 2109 | ||
2110 | impl ast::NameOwner for MacroCall {} | 2110 | impl ast::NameOwner for MacroCall {} |
2111 | impl ast::AttrsOwner for MacroCall {} | ||
2111 | impl MacroCall { | 2112 | impl MacroCall { |
2112 | pub fn token_tree(&self) -> Option<&TokenTree> { | 2113 | pub fn token_tree(&self) -> Option<&TokenTree> { |
2113 | super::child_opt(self) | 2114 | super::child_opt(self) |
diff --git a/crates/ra_syntax/src/grammar.ron b/crates/ra_syntax/src/grammar.ron index 66f1339c1..4f8e19bd0 100644 --- a/crates/ra_syntax/src/grammar.ron +++ b/crates/ra_syntax/src/grammar.ron | |||
@@ -557,7 +557,7 @@ Grammar( | |||
557 | "Name": (), | 557 | "Name": (), |
558 | "NameRef": (), | 558 | "NameRef": (), |
559 | "MacroCall": ( | 559 | "MacroCall": ( |
560 | traits: [ "NameOwner" ], | 560 | traits: [ "NameOwner", "AttrsOwner" ], |
561 | options: [ "TokenTree", "Path" ], | 561 | options: [ "TokenTree", "Path" ], |
562 | ), | 562 | ), |
563 | "Attr": ( options: [ ["value", "TokenTree"] ] ), | 563 | "Attr": ( options: [ ["value", "TokenTree"] ] ), |