diff options
Diffstat (limited to 'crates/libsyntax2/src/ast')
-rw-r--r-- | crates/libsyntax2/src/ast/mod.rs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/crates/libsyntax2/src/ast/mod.rs b/crates/libsyntax2/src/ast/mod.rs index 56bc099fe..e9362d048 100644 --- a/crates/libsyntax2/src/ast/mod.rs +++ b/crates/libsyntax2/src/ast/mod.rs | |||
@@ -1,6 +1,9 @@ | |||
1 | mod generated; | 1 | mod generated; |
2 | 2 | ||
3 | use std::sync::Arc; | 3 | use std::sync::Arc; |
4 | |||
5 | use smol_str::SmolStr; | ||
6 | |||
4 | use { | 7 | use { |
5 | SyntaxNode, SyntaxRoot, TreeRoot, SyntaxError, | 8 | SyntaxNode, SyntaxRoot, TreeRoot, SyntaxError, |
6 | SyntaxKind::*, | 9 | SyntaxKind::*, |
@@ -64,7 +67,9 @@ impl<R: TreeRoot> Function<R> { | |||
64 | } | 67 | } |
65 | 68 | ||
66 | impl<R: TreeRoot> Name<R> { | 69 | impl<R: TreeRoot> Name<R> { |
67 | pub fn text(&self) -> String { | 70 | pub fn text(&self) -> SmolStr { |
68 | self.syntax().text() | 71 | let ident = self.syntax().first_child() |
72 | .unwrap(); | ||
73 | ident.leaf_text().unwrap() | ||
69 | } | 74 | } |
70 | } | 75 | } |