diff options
Diffstat (limited to 'crates/libsyntax2/src/yellow/syntax.rs')
-rw-r--r-- | crates/libsyntax2/src/yellow/syntax.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/crates/libsyntax2/src/yellow/syntax.rs b/crates/libsyntax2/src/yellow/syntax.rs index 00f76e51c..b264e008a 100644 --- a/crates/libsyntax2/src/yellow/syntax.rs +++ b/crates/libsyntax2/src/yellow/syntax.rs | |||
@@ -1,5 +1,7 @@ | |||
1 | use std::{fmt, sync::Arc}; | 1 | use std::{fmt, sync::Arc}; |
2 | 2 | ||
3 | use smol_str::SmolStr; | ||
4 | |||
3 | use { | 5 | use { |
4 | yellow::{RedNode, TreeRoot, SyntaxRoot, RedPtr}, | 6 | yellow::{RedNode, TreeRoot, SyntaxRoot, RedPtr}, |
5 | SyntaxKind::{self, *}, | 7 | SyntaxKind::{self, *}, |
@@ -116,6 +118,10 @@ impl<R: TreeRoot> SyntaxNode<R> { | |||
116 | self.first_child().is_none() | 118 | self.first_child().is_none() |
117 | } | 119 | } |
118 | 120 | ||
121 | pub fn leaf_text(&self) -> Option<SmolStr> { | ||
122 | self.red().green().leaf_text() | ||
123 | } | ||
124 | |||
119 | fn red(&self) -> &RedNode { | 125 | fn red(&self) -> &RedNode { |
120 | unsafe { self.red.get(&self.root) } | 126 | unsafe { self.red.get(&self.root) } |
121 | } | 127 | } |