diff options
Diffstat (limited to 'crates/ra_syntax/src/ast.rs')
-rw-r--r-- | crates/ra_syntax/src/ast.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/crates/ra_syntax/src/ast.rs b/crates/ra_syntax/src/ast.rs index 22105d6c9..350f01f33 100644 --- a/crates/ra_syntax/src/ast.rs +++ b/crates/ra_syntax/src/ast.rs | |||
@@ -153,6 +153,20 @@ impl FnDef { | |||
153 | } | 153 | } |
154 | 154 | ||
155 | impl Attr { | 155 | impl Attr { |
156 | pub fn is_inner(&self) -> bool { | ||
157 | let tt = match self.value() { | ||
158 | None => return false, | ||
159 | Some(tt) => tt, | ||
160 | }; | ||
161 | |||
162 | let prev = match tt.syntax().prev_sibling() { | ||
163 | None => return false, | ||
164 | Some(prev) => prev, | ||
165 | }; | ||
166 | |||
167 | prev.kind() == EXCL | ||
168 | } | ||
169 | |||
156 | pub fn as_atom(&self) -> Option<SmolStr> { | 170 | pub fn as_atom(&self) -> Option<SmolStr> { |
157 | let tt = self.value()?; | 171 | let tt = self.value()?; |
158 | let (_bra, attr, _ket) = tt.syntax().children().collect_tuple()?; | 172 | let (_bra, attr, _ket) = tt.syntax().children().collect_tuple()?; |