smol_str to a crate

This commit is contained in:
Aleksey Kladov 2018-08-13 14:24:22 +03:00
parent 18486a02fa
commit ed2ac17133
11 changed files with 101 additions and 23 deletions

View file

@ -1,5 +1,7 @@
use std::{fmt, sync::Arc};
use smol_str::SmolStr;
use {
yellow::{RedNode, TreeRoot, SyntaxRoot, RedPtr},
SyntaxKind::{self, *},
@ -116,6 +118,10 @@ impl<R: TreeRoot> SyntaxNode<R> {
self.first_child().is_none()
}
pub fn leaf_text(&self) -> Option<SmolStr> {
self.red().green().leaf_text()
}
fn red(&self) -> &RedNode {
unsafe { self.red.get(&self.root) }
}