aboutsummaryrefslogtreecommitdiff
path: root/crates/libsyntax2/src/yellow/syntax.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-08-13 12:24:22 +0100
committerAleksey Kladov <[email protected]>2018-08-13 12:24:22 +0100
commited2ac1713326df6b926062efcc6109a20cdf7c37 (patch)
treec1c75d09e2adbbd54190c5b6ce6efdb7ea251da3 /crates/libsyntax2/src/yellow/syntax.rs
parent18486a02fae5966e61f16ea7bc5c33c6c7c69487 (diff)
smol_str to a crate
Diffstat (limited to 'crates/libsyntax2/src/yellow/syntax.rs')
-rw-r--r--crates/libsyntax2/src/yellow/syntax.rs6
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 @@
1use std::{fmt, sync::Arc}; 1use std::{fmt, sync::Arc};
2 2
3use smol_str::SmolStr;
4
3use { 5use {
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 }