diff options
Diffstat (limited to 'crates/libsyntax2/src/ast')
-rw-r--r-- | crates/libsyntax2/src/ast/mod.rs | 25 |
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; | |||
4 | use smol_str::SmolStr; | 4 | use smol_str::SmolStr; |
5 | 5 | ||
6 | use { | 6 | use { |
7 | SyntaxNode, SyntaxNodeRef, TreeRoot, SyntaxError, | 7 | SyntaxNodeRef, SyntaxKind::*, |
8 | SyntaxKind::*, | ||
9 | }; | 8 | }; |
10 | pub use self::generated::*; | 9 | pub 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)] | ||
41 | pub struct ParsedFile { | ||
42 | root: SyntaxNode | ||
43 | } | ||
44 | |||
45 | impl 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 | |||
62 | impl<'a> FnDef<'a> { | 39 | impl<'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() |