aboutsummaryrefslogtreecommitdiff
path: root/crates/libsyntax2/src/utils.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-08-17 19:10:55 +0100
committerAleksey Kladov <[email protected]>2018-08-17 19:10:55 +0100
commit70097504f78c4c41368a0b864a94df95fb9c27f7 (patch)
treec4034cab3c0d0b9488c0be538ae1d4c286570de9 /crates/libsyntax2/src/utils.rs
parented7ae78c6fd9e508f6e959c6a164cf8481f6b377 (diff)
hide root
Diffstat (limited to 'crates/libsyntax2/src/utils.rs')
-rw-r--r--crates/libsyntax2/src/utils.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/crates/libsyntax2/src/utils.rs b/crates/libsyntax2/src/utils.rs
index 1fbb872a5..4f60aa2a8 100644
--- a/crates/libsyntax2/src/utils.rs
+++ b/crates/libsyntax2/src/utils.rs
@@ -1,13 +1,13 @@
1use std::fmt::Write; 1use std::fmt::Write;
2use { 2use {
3 algo::walk::{walk, WalkEvent}, 3 algo::walk::{walk, WalkEvent},
4 SyntaxNode, 4 SyntaxNode, 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.
8pub fn dump_tree(syntax: &SyntaxNode) -> String { 8pub fn dump_tree(syntax: &SyntaxNode) -> String {
9 let syntax = syntax.as_ref(); 9 let syntax = syntax.as_ref();
10 let mut errors: Vec<_> = syntax.root.errors.iter().cloned().collect(); 10 let mut errors: Vec<_> = syntax.root.syntax_root().errors.iter().cloned().collect();
11 errors.sort_by_key(|e| e.offset); 11 errors.sort_by_key(|e| e.offset);
12 let mut err_pos = 0; 12 let mut err_pos = 0;
13 let mut level = 0; 13 let mut level = 0;