diff options
author | Aleksey Kladov <[email protected]> | 2018-07-28 11:07:10 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-07-28 11:07:10 +0100 |
commit | 8d9961b75377a7bd2656b5aa1451710de8c86f60 (patch) | |
tree | c2dcedf487d2ad4674edb012dd579aa74173d8c2 /src/tree | |
parent | 52dc0ddc84544a59d3a2580d9944d0482a633349 (diff) |
Migrate to text-unit
Diffstat (limited to 'src/tree')
-rw-r--r-- | src/tree/file_builder.rs | 6 | ||||
-rw-r--r-- | src/tree/mod.rs | 8 |
2 files changed, 6 insertions, 8 deletions
diff --git a/src/tree/file_builder.rs b/src/tree/file_builder.rs index f831676c7..712602168 100644 --- a/src/tree/file_builder.rs +++ b/src/tree/file_builder.rs | |||
@@ -31,7 +31,7 @@ impl Sink for FileBuilder { | |||
31 | fn leaf(&mut self, kind: SyntaxKind, len: TextUnit) { | 31 | fn leaf(&mut self, kind: SyntaxKind, len: TextUnit) { |
32 | let leaf = NodeData { | 32 | let leaf = NodeData { |
33 | kind, | 33 | kind, |
34 | range: TextRange::from_len(self.pos, len), | 34 | range: TextRange::offset_len(self.pos, len), |
35 | parent: None, | 35 | parent: None, |
36 | first_child: None, | 36 | first_child: None, |
37 | next_sibling: None, | 37 | next_sibling: None, |
@@ -44,7 +44,7 @@ impl Sink for FileBuilder { | |||
44 | fn start_internal(&mut self, kind: SyntaxKind) { | 44 | fn start_internal(&mut self, kind: SyntaxKind) { |
45 | let node = NodeData { | 45 | let node = NodeData { |
46 | kind, | 46 | kind, |
47 | range: TextRange::from_len(self.pos, 0.into()), | 47 | range: TextRange::offset_len(self.pos, 0.into()), |
48 | parent: None, | 48 | parent: None, |
49 | first_child: None, | 49 | first_child: None, |
50 | next_sibling: None, | 50 | next_sibling: None, |
@@ -83,7 +83,7 @@ impl FileBuilder { | |||
83 | nodes: Vec::new(), | 83 | nodes: Vec::new(), |
84 | errors: Vec::new(), | 84 | errors: Vec::new(), |
85 | in_progress: Vec::new(), | 85 | in_progress: Vec::new(), |
86 | pos: TextUnit::new(0), | 86 | pos: 0.into(), |
87 | } | 87 | } |
88 | } | 88 | } |
89 | 89 | ||
diff --git a/src/tree/mod.rs b/src/tree/mod.rs index ebf26777b..f7b16d7b5 100644 --- a/src/tree/mod.rs +++ b/src/tree/mod.rs | |||
@@ -1,9 +1,7 @@ | |||
1 | use text::{TextRange, TextUnit}; | ||
2 | |||
3 | use std::fmt; | ||
4 | use std::cmp; | ||
5 | |||
6 | mod file_builder; | 1 | mod file_builder; |
2 | |||
3 | use ::{TextRange, TextUnit}; | ||
4 | use std::{fmt, cmp}; | ||
7 | pub(crate) use self::file_builder::{ErrorMsg, FileBuilder, Sink}; | 5 | pub(crate) use self::file_builder::{ErrorMsg, FileBuilder, Sink}; |
8 | 6 | ||
9 | pub use syntax_kinds::SyntaxKind; | 7 | pub use syntax_kinds::SyntaxKind; |