diff options
author | Aleksey Kladov <[email protected]> | 2019-07-18 21:19:04 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-07-18 21:19:04 +0100 |
commit | df33e7685bdb0f63bf6aa809b9046708d563a1a7 (patch) | |
tree | 2336c03a0eeef98ac375868bd27dfe7e50668869 /crates/ra_syntax/src/lib.rs | |
parent | a6224f36200c768d49b6450204fd95edaa559b50 (diff) |
use Parse in mbe
Diffstat (limited to 'crates/ra_syntax/src/lib.rs')
-rw-r--r-- | crates/ra_syntax/src/lib.rs | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/crates/ra_syntax/src/lib.rs b/crates/ra_syntax/src/lib.rs index 2eb3fcd57..534c206a6 100644 --- a/crates/ra_syntax/src/lib.rs +++ b/crates/ra_syntax/src/lib.rs | |||
@@ -35,7 +35,7 @@ use std::{fmt::Write, sync::Arc}; | |||
35 | 35 | ||
36 | use ra_text_edit::AtomTextEdit; | 36 | use ra_text_edit::AtomTextEdit; |
37 | 37 | ||
38 | use crate::syntax_node::{GreenNode, SyntaxNodeWrapper}; | 38 | use crate::syntax_node::GreenNode; |
39 | 39 | ||
40 | pub use crate::{ | 40 | pub use crate::{ |
41 | ast::{AstNode, AstToken}, | 41 | ast::{AstNode, AstToken}, |
@@ -43,8 +43,8 @@ pub use crate::{ | |||
43 | ptr::{AstPtr, SyntaxNodePtr}, | 43 | ptr::{AstPtr, SyntaxNodePtr}, |
44 | syntax_error::{Location, SyntaxError, SyntaxErrorKind}, | 44 | syntax_error::{Location, SyntaxError, SyntaxErrorKind}, |
45 | syntax_node::{ | 45 | syntax_node::{ |
46 | Direction, InsertPosition, SyntaxElement, SyntaxNode, SyntaxToken, SyntaxTreeBuilder, | 46 | Direction, InsertPosition, SyntaxElement, SyntaxNode, SyntaxNodeWrapper, SyntaxToken, |
47 | TreeArc, WalkEvent, | 47 | SyntaxTreeBuilder, TreeArc, WalkEvent, |
48 | }, | 48 | }, |
49 | syntax_text::SyntaxText, | 49 | syntax_text::SyntaxText, |
50 | }; | 50 | }; |
@@ -91,6 +91,12 @@ impl<T: SyntaxNodeWrapper> Parse<T> { | |||
91 | } | 91 | } |
92 | } | 92 | } |
93 | 93 | ||
94 | impl<T: AstNode> Parse<T> { | ||
95 | pub fn to_syntax(this: Self) -> Parse<SyntaxNode> { | ||
96 | Parse { tree: this.tree().syntax().to_owned(), errors: this.errors } | ||
97 | } | ||
98 | } | ||
99 | |||
94 | impl Parse<SourceFile> { | 100 | impl Parse<SourceFile> { |
95 | pub fn debug_dump(&self) -> String { | 101 | pub fn debug_dump(&self) -> String { |
96 | let mut buf = self.tree.syntax().debug_dump(); | 102 | let mut buf = self.tree.syntax().debug_dump(); |