mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 14:21:44 +00:00
switch to upstream rowan's API
This commit is contained in:
parent
7bde8012cb
commit
c9cfd57eea
22 changed files with 208 additions and 738 deletions
|
@ -2,7 +2,7 @@
|
|||
|
||||
use crate::{
|
||||
ast::{self, child_opt, children, AstChildren, AstNode},
|
||||
SmolStr, SyntaxElement,
|
||||
SmolStr,
|
||||
SyntaxKind::*,
|
||||
SyntaxToken, T,
|
||||
};
|
||||
|
@ -229,14 +229,11 @@ pub enum LiteralKind {
|
|||
|
||||
impl ast::Literal {
|
||||
pub fn token(&self) -> SyntaxToken {
|
||||
let elem = self
|
||||
.syntax()
|
||||
self.syntax()
|
||||
.children_with_tokens()
|
||||
.find(|e| e.kind() != ATTR && !e.kind().is_trivia());
|
||||
match elem {
|
||||
Some(SyntaxElement::Token(token)) => token,
|
||||
_ => unreachable!(),
|
||||
}
|
||||
.find(|e| e.kind() != ATTR && !e.kind().is_trivia())
|
||||
.and_then(|e| e.into_token())
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
pub fn kind(&self) -> LiteralKind {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue