diff options
author | Aleksey Kladov <[email protected]> | 2018-08-17 20:00:13 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-08-17 20:00:13 +0100 |
commit | d3c90ded2b9a4f75e101fa3abc60cd3aebc439c9 (patch) | |
tree | 6d2388eb68605331a0dd090269372bc98dd038cd /crates/libsyntax2/src/utils.rs | |
parent | 70097504f78c4c41368a0b864a94df95fb9c27f7 (diff) |
Borrowed AST
Diffstat (limited to 'crates/libsyntax2/src/utils.rs')
-rw-r--r-- | crates/libsyntax2/src/utils.rs | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/crates/libsyntax2/src/utils.rs b/crates/libsyntax2/src/utils.rs index 4f60aa2a8..fbe48dd71 100644 --- a/crates/libsyntax2/src/utils.rs +++ b/crates/libsyntax2/src/utils.rs | |||
@@ -1,12 +1,11 @@ | |||
1 | use std::fmt::Write; | 1 | use std::fmt::Write; |
2 | use { | 2 | use { |
3 | algo::walk::{walk, WalkEvent}, | 3 | algo::walk::{walk, WalkEvent}, |
4 | SyntaxNode, TreeRoot, | 4 | SyntaxNodeRef, TreeRoot, |
5 | }; | 5 | }; |
6 | 6 | ||
7 | /// Parse a file and create a string representation of the resulting parse tree. | 7 | /// Parse a file and create a string representation of the resulting parse tree. |
8 | pub fn dump_tree(syntax: &SyntaxNode) -> String { | 8 | pub fn dump_tree(syntax: SyntaxNodeRef) -> String { |
9 | let syntax = syntax.as_ref(); | ||
10 | let mut errors: Vec<_> = syntax.root.syntax_root().errors.iter().cloned().collect(); | 9 | let mut errors: Vec<_> = syntax.root.syntax_root().errors.iter().cloned().collect(); |
11 | errors.sort_by_key(|e| e.offset); | 10 | errors.sort_by_key(|e| e.offset); |
12 | let mut err_pos = 0; | 11 | let mut err_pos = 0; |