diff options
Diffstat (limited to 'src/yellow/red.rs')
-rw-r--r-- | src/yellow/red.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/yellow/red.rs b/src/yellow/red.rs index e2dbceeae..3fdbfe0c5 100644 --- a/src/yellow/red.rs +++ b/src/yellow/red.rs | |||
@@ -1,7 +1,7 @@ | |||
1 | use std::sync::{Arc, RwLock}; | 1 | use std::sync::{Arc, RwLock}; |
2 | use { | 2 | use { |
3 | TextUnit, | 3 | TextUnit, |
4 | yellow::{Ptr, GreenNode}, | 4 | yellow::GreenNode, |
5 | }; | 5 | }; |
6 | 6 | ||
7 | #[derive(Debug)] | 7 | #[derive(Debug)] |
@@ -13,7 +13,7 @@ pub(crate) struct RedNode { | |||
13 | 13 | ||
14 | #[derive(Debug)] | 14 | #[derive(Debug)] |
15 | struct ParentData { | 15 | struct ParentData { |
16 | parent: Ptr<RedNode>, | 16 | parent: *const RedNode, |
17 | start_offset: TextUnit, | 17 | start_offset: TextUnit, |
18 | index_in_parent: usize, | 18 | index_in_parent: usize, |
19 | } | 19 | } |
@@ -27,7 +27,7 @@ impl RedNode { | |||
27 | 27 | ||
28 | fn new_child( | 28 | fn new_child( |
29 | green: GreenNode, | 29 | green: GreenNode, |
30 | parent: Ptr<RedNode>, | 30 | parent: *const RedNode, |
31 | start_offset: TextUnit, | 31 | start_offset: TextUnit, |
32 | index_in_parent: usize, | 32 | index_in_parent: usize, |
33 | ) -> RedNode { | 33 | ) -> RedNode { |
@@ -62,7 +62,7 @@ impl RedNode { | |||
62 | self.green.children().len() | 62 | self.green.children().len() |
63 | } | 63 | } |
64 | 64 | ||
65 | pub(crate) fn nth_child(&self, me: Ptr<RedNode>, idx: usize) -> Arc<RedNode> { | 65 | pub(crate) fn nth_child(&self, idx: usize) -> Arc<RedNode> { |
66 | match &self.children.read().unwrap()[idx] { | 66 | match &self.children.read().unwrap()[idx] { |
67 | Some(child) => return child.clone(), | 67 | Some(child) => return child.clone(), |
68 | None => (), | 68 | None => (), |
@@ -72,7 +72,7 @@ impl RedNode { | |||
72 | let green_children = self.green.children(); | 72 | let green_children = self.green.children(); |
73 | let start_offset = self.start_offset() | 73 | let start_offset = self.start_offset() |
74 | + green_children[..idx].iter().map(|x| x.text_len()).sum::<TextUnit>(); | 74 | + green_children[..idx].iter().map(|x| x.text_len()).sum::<TextUnit>(); |
75 | let child = RedNode::new_child(green_children[idx].clone(), me, start_offset, idx); | 75 | let child = RedNode::new_child(green_children[idx].clone(), self, start_offset, idx); |
76 | children[idx] = Some(Arc::new(child)) | 76 | children[idx] = Some(Arc::new(child)) |
77 | } | 77 | } |
78 | children[idx].as_ref().unwrap().clone() | 78 | children[idx].as_ref().unwrap().clone() |