diff options
Diffstat (limited to 'crates/ra_syntax/src/ast/extensions.rs')
-rw-r--r-- | crates/ra_syntax/src/ast/extensions.rs | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/crates/ra_syntax/src/ast/extensions.rs b/crates/ra_syntax/src/ast/extensions.rs index c7df15662..ff3525c84 100644 --- a/crates/ra_syntax/src/ast/extensions.rs +++ b/crates/ra_syntax/src/ast/extensions.rs | |||
@@ -23,7 +23,7 @@ impl ast::NameRef { | |||
23 | } | 23 | } |
24 | 24 | ||
25 | pub fn as_tuple_field(&self) -> Option<usize> { | 25 | pub fn as_tuple_field(&self) -> Option<usize> { |
26 | if let Some(ast::NameRefToken::IntNumber(token)) = self.name_ref_token() { | 26 | if let Some(ast::NameRefToken::IntNumber(token)) = self.name_ref_token_token() { |
27 | token.text().as_str().parse().ok() | 27 | token.text().as_str().parse().ok() |
28 | } else { | 28 | } else { |
29 | None | 29 | None |
@@ -138,7 +138,7 @@ impl ast::Path { | |||
138 | 138 | ||
139 | impl ast::Module { | 139 | impl ast::Module { |
140 | pub fn has_semi(&self) -> bool { | 140 | pub fn has_semi(&self) -> bool { |
141 | self.semi().is_some() | 141 | self.semi_token().is_some() |
142 | } | 142 | } |
143 | } | 143 | } |
144 | 144 | ||
@@ -174,7 +174,7 @@ impl ast::ImplDef { | |||
174 | } | 174 | } |
175 | 175 | ||
176 | pub fn is_negative(&self) -> bool { | 176 | pub fn is_negative(&self) -> bool { |
177 | self.excl().is_some() | 177 | self.excl_token().is_some() |
178 | } | 178 | } |
179 | } | 179 | } |
180 | 180 | ||
@@ -218,11 +218,11 @@ impl ast::EnumVariant { | |||
218 | 218 | ||
219 | impl ast::FnDef { | 219 | impl ast::FnDef { |
220 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { | 220 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { |
221 | Some(self.semi()?.syntax().clone()) | 221 | Some(self.semi_token()?.syntax().clone()) |
222 | } | 222 | } |
223 | 223 | ||
224 | pub fn is_async(&self) -> bool { | 224 | pub fn is_async(&self) -> bool { |
225 | self.async_kw().is_some() | 225 | self.async_kw_token().is_some() |
226 | } | 226 | } |
227 | } | 227 | } |
228 | 228 | ||
@@ -233,15 +233,11 @@ impl ast::LetStmt { | |||
233 | Some(node) => node.kind() == T![;], | 233 | Some(node) => node.kind() == T![;], |
234 | } | 234 | } |
235 | } | 235 | } |
236 | |||
237 | pub fn eq_token(&self) -> Option<SyntaxToken> { | ||
238 | Some(self.eq()?.syntax().clone()) | ||
239 | } | ||
240 | } | 236 | } |
241 | 237 | ||
242 | impl ast::ExprStmt { | 238 | impl ast::ExprStmt { |
243 | pub fn has_semi(&self) -> bool { | 239 | pub fn has_semi(&self) -> bool { |
244 | self.semi().is_some() | 240 | self.semi_token().is_some() |
245 | } | 241 | } |
246 | } | 242 | } |
247 | 243 | ||
@@ -350,7 +346,7 @@ pub enum SelfParamKind { | |||
350 | 346 | ||
351 | impl ast::SelfParam { | 347 | impl ast::SelfParam { |
352 | pub fn kind(&self) -> SelfParamKind { | 348 | pub fn kind(&self) -> SelfParamKind { |
353 | if self.amp().is_some() { | 349 | if self.amp_token().is_some() { |
354 | if self.amp_mut_kw().is_some() { | 350 | if self.amp_mut_kw().is_some() { |
355 | SelfParamKind::MutRef | 351 | SelfParamKind::MutRef |
356 | } else { | 352 | } else { |
@@ -396,7 +392,7 @@ impl ast::TypeBound { | |||
396 | TypeBoundKind::PathType(path_type) | 392 | TypeBoundKind::PathType(path_type) |
397 | } else if let Some(for_type) = children(self).next() { | 393 | } else if let Some(for_type) = children(self).next() { |
398 | TypeBoundKind::ForType(for_type) | 394 | TypeBoundKind::ForType(for_type) |
399 | } else if let Some(lifetime) = self.lifetime() { | 395 | } else if let Some(lifetime) = self.lifetime_token() { |
400 | TypeBoundKind::Lifetime(lifetime) | 396 | TypeBoundKind::Lifetime(lifetime) |
401 | } else { | 397 | } else { |
402 | unreachable!() | 398 | unreachable!() |
@@ -416,7 +412,7 @@ impl ast::TypeBound { | |||
416 | } | 412 | } |
417 | 413 | ||
418 | pub fn question(&self) -> Option<ast::Question> { | 414 | pub fn question(&self) -> Option<ast::Question> { |
419 | if self.const_kw().is_some() { | 415 | if self.const_kw_token().is_some() { |
420 | self.syntax() | 416 | self.syntax() |
421 | .children_with_tokens() | 417 | .children_with_tokens() |
422 | .filter_map(|it| it.into_token()) | 418 | .filter_map(|it| it.into_token()) |