aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_syntax/src/lib.rs')
-rw-r--r--crates/ra_syntax/src/lib.rs12
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
36use ra_text_edit::AtomTextEdit; 36use ra_text_edit::AtomTextEdit;
37 37
38use crate::syntax_node::{GreenNode, SyntaxNodeWrapper}; 38use crate::syntax_node::GreenNode;
39 39
40pub use crate::{ 40pub 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
94impl<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
94impl Parse<SourceFile> { 100impl 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();