mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
use Parse in mbe
This commit is contained in:
parent
a6224f3620
commit
df33e7685b
7 changed files with 64 additions and 63 deletions
|
@ -35,7 +35,7 @@ use std::{fmt::Write, sync::Arc};
|
|||
|
||||
use ra_text_edit::AtomTextEdit;
|
||||
|
||||
use crate::syntax_node::{GreenNode, SyntaxNodeWrapper};
|
||||
use crate::syntax_node::GreenNode;
|
||||
|
||||
pub use crate::{
|
||||
ast::{AstNode, AstToken},
|
||||
|
@ -43,8 +43,8 @@ pub use crate::{
|
|||
ptr::{AstPtr, SyntaxNodePtr},
|
||||
syntax_error::{Location, SyntaxError, SyntaxErrorKind},
|
||||
syntax_node::{
|
||||
Direction, InsertPosition, SyntaxElement, SyntaxNode, SyntaxToken, SyntaxTreeBuilder,
|
||||
TreeArc, WalkEvent,
|
||||
Direction, InsertPosition, SyntaxElement, SyntaxNode, SyntaxNodeWrapper, SyntaxToken,
|
||||
SyntaxTreeBuilder, TreeArc, WalkEvent,
|
||||
},
|
||||
syntax_text::SyntaxText,
|
||||
};
|
||||
|
@ -91,6 +91,12 @@ impl<T: SyntaxNodeWrapper> Parse<T> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T: AstNode> Parse<T> {
|
||||
pub fn to_syntax(this: Self) -> Parse<SyntaxNode> {
|
||||
Parse { tree: this.tree().syntax().to_owned(), errors: this.errors }
|
||||
}
|
||||
}
|
||||
|
||||
impl Parse<SourceFile> {
|
||||
pub fn debug_dump(&self) -> String {
|
||||
let mut buf = self.tree.syntax().debug_dump();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue