aboutsummaryrefslogtreecommitdiff
path: root/crates/libsyntax2/src/ast
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-08-25 09:40:17 +0100
committerAleksey Kladov <[email protected]>2018-08-25 09:40:17 +0100
commit9fae494a8da347a32cdcd3dcd714ba00aaff9664 (patch)
tree9fe4fb51c374d036e22d5a60ce50b63dbe287142 /crates/libsyntax2/src/ast
parentf104458d45e30024f8a4a02c1ad4101ed74b08f9 (diff)
Move ParsedFile to top
Diffstat (limited to 'crates/libsyntax2/src/ast')
-rw-r--r--crates/libsyntax2/src/ast/mod.rs25
1 files changed, 1 insertions, 24 deletions
diff --git a/crates/libsyntax2/src/ast/mod.rs b/crates/libsyntax2/src/ast/mod.rs
index ba80fc64e..6217c5b74 100644
--- a/crates/libsyntax2/src/ast/mod.rs
+++ b/crates/libsyntax2/src/ast/mod.rs
@@ -4,8 +4,7 @@ use itertools::Itertools;
4use smol_str::SmolStr; 4use smol_str::SmolStr;
5 5
6use { 6use {
7 SyntaxNode, SyntaxNodeRef, TreeRoot, SyntaxError, 7 SyntaxNodeRef, SyntaxKind::*,
8 SyntaxKind::*,
9}; 8};
10pub use self::generated::*; 9pub use self::generated::*;
11 10
@@ -37,28 +36,6 @@ pub trait AttrsOwner<'a>: AstNode<'a> {
37 } 36 }
38} 37}
39 38
40#[derive(Clone, Debug)]
41pub struct ParsedFile {
42 root: SyntaxNode
43}
44
45impl ParsedFile {
46 pub fn parse(text: &str) -> Self {
47 let root = ::parse(text);
48 ParsedFile { root }
49 }
50 pub fn ast(&self) -> File {
51 File::cast(self.syntax()).unwrap()
52 }
53 pub fn syntax(&self) -> SyntaxNodeRef {
54 self.root.borrowed()
55 }
56 pub fn errors(&self) -> Vec<SyntaxError> {
57 self.syntax().root.syntax_root().errors.clone()
58 }
59
60}
61
62impl<'a> FnDef<'a> { 39impl<'a> FnDef<'a> {
63 pub fn has_atom_attr(&self, atom: &str) -> bool { 40 pub fn has_atom_attr(&self, atom: &str) -> bool {
64 self.attrs() 41 self.attrs()