diff options
author | Aleksey Kladov <[email protected]> | 2019-01-11 16:59:06 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-01-11 16:59:06 +0000 |
commit | 2d3940d0ab862dbfaed4f4c844faaca6a38e31e9 (patch) | |
tree | 0d8412f73a0fa6f9c1e6913e6133d3daf25dcb91 /crates/ra_syntax/src/lib.rs | |
parent | aad1bf877e4ba5ce9e28e8bde14f790ef8d1551b (diff) |
rename TreePtr -> TreeArc
This is much clearer about the semantics
Diffstat (limited to 'crates/ra_syntax/src/lib.rs')
-rw-r--r-- | crates/ra_syntax/src/lib.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/crates/ra_syntax/src/lib.rs b/crates/ra_syntax/src/lib.rs index 1dbfca91b..2a095817a 100644 --- a/crates/ra_syntax/src/lib.rs +++ b/crates/ra_syntax/src/lib.rs | |||
@@ -41,7 +41,7 @@ pub use crate::{ | |||
41 | ast::AstNode, | 41 | ast::AstNode, |
42 | lexer::{tokenize, Token}, | 42 | lexer::{tokenize, Token}, |
43 | syntax_kinds::SyntaxKind, | 43 | syntax_kinds::SyntaxKind, |
44 | yellow::{Direction, SyntaxError, SyntaxNode, WalkEvent, Location, TreePtr}, | 44 | yellow::{Direction, SyntaxError, SyntaxNode, WalkEvent, Location, TreeArc}, |
45 | }; | 45 | }; |
46 | 46 | ||
47 | use ra_text_edit::AtomTextEdit; | 47 | use ra_text_edit::AtomTextEdit; |
@@ -51,29 +51,29 @@ use crate::yellow::GreenNode; | |||
51 | pub use crate::ast::SourceFile; | 51 | pub use crate::ast::SourceFile; |
52 | 52 | ||
53 | impl SourceFile { | 53 | impl SourceFile { |
54 | fn new(green: GreenNode, errors: Vec<SyntaxError>) -> TreePtr<SourceFile> { | 54 | fn new(green: GreenNode, errors: Vec<SyntaxError>) -> TreeArc<SourceFile> { |
55 | let root = SyntaxNode::new(green, errors); | 55 | let root = SyntaxNode::new(green, errors); |
56 | if cfg!(debug_assertions) { | 56 | if cfg!(debug_assertions) { |
57 | utils::validate_block_structure(&root); | 57 | utils::validate_block_structure(&root); |
58 | } | 58 | } |
59 | assert_eq!(root.kind(), SyntaxKind::SOURCE_FILE); | 59 | assert_eq!(root.kind(), SyntaxKind::SOURCE_FILE); |
60 | TreePtr::cast(root) | 60 | TreeArc::cast(root) |
61 | } | 61 | } |
62 | pub fn parse(text: &str) -> TreePtr<SourceFile> { | 62 | pub fn parse(text: &str) -> TreeArc<SourceFile> { |
63 | let tokens = tokenize(&text); | 63 | let tokens = tokenize(&text); |
64 | let (green, errors) = | 64 | let (green, errors) = |
65 | parser_impl::parse_with(yellow::GreenBuilder::new(), text, &tokens, grammar::root); | 65 | parser_impl::parse_with(yellow::GreenBuilder::new(), text, &tokens, grammar::root); |
66 | SourceFile::new(green, errors) | 66 | SourceFile::new(green, errors) |
67 | } | 67 | } |
68 | pub fn reparse(&self, edit: &AtomTextEdit) -> TreePtr<SourceFile> { | 68 | pub fn reparse(&self, edit: &AtomTextEdit) -> TreeArc<SourceFile> { |
69 | self.incremental_reparse(edit) | 69 | self.incremental_reparse(edit) |
70 | .unwrap_or_else(|| self.full_reparse(edit)) | 70 | .unwrap_or_else(|| self.full_reparse(edit)) |
71 | } | 71 | } |
72 | pub fn incremental_reparse(&self, edit: &AtomTextEdit) -> Option<TreePtr<SourceFile>> { | 72 | pub fn incremental_reparse(&self, edit: &AtomTextEdit) -> Option<TreeArc<SourceFile>> { |
73 | reparsing::incremental_reparse(self.syntax(), edit, self.errors()) | 73 | reparsing::incremental_reparse(self.syntax(), edit, self.errors()) |
74 | .map(|(green_node, errors)| SourceFile::new(green_node, errors)) | 74 | .map(|(green_node, errors)| SourceFile::new(green_node, errors)) |
75 | } | 75 | } |
76 | fn full_reparse(&self, edit: &AtomTextEdit) -> TreePtr<SourceFile> { | 76 | fn full_reparse(&self, edit: &AtomTextEdit) -> TreeArc<SourceFile> { |
77 | let text = edit.apply(self.syntax().text().to_string()); | 77 | let text = edit.apply(self.syntax().text().to_string()); |
78 | SourceFile::parse(&text) | 78 | SourceFile::parse(&text) |
79 | } | 79 | } |