hide root

This commit is contained in:
Aleksey Kladov
2018-08-17 21:10:55 +03:00
parent ed7ae78c6f
commit 70097504f7
10 changed files with 91 additions and 65 deletions

View File

@@ -1,12 +1,10 @@
mod generated;
use std::sync::Arc;
use itertools::Itertools;
use smol_str::SmolStr;
use {
SyntaxNode, SyntaxNodeRef, SyntaxRoot, TreeRoot, SyntaxError,
SyntaxNode, SyntaxNodeRef, OwnedRoot, TreeRoot, SyntaxError,
SyntaxKind::*,
};
pub use self::generated::*;
@@ -37,7 +35,7 @@ pub trait AttrsOwner<R: TreeRoot>: AstNode<R> {
}
}
impl File<Arc<SyntaxRoot>> {
impl File<OwnedRoot> {
pub fn parse(text: &str) -> Self {
File::cast(::parse(text)).unwrap()
}
@@ -45,7 +43,7 @@ impl File<Arc<SyntaxRoot>> {
impl<R: TreeRoot> File<R> {
pub fn errors(&self) -> Vec<SyntaxError> {
self.syntax().root.errors.clone()
self.syntax().root.syntax_root().errors.clone()
}
}