This commit is contained in:
Aleksey Kladov 2018-09-04 19:00:01 +03:00
parent 8ed06d766f
commit 8b0210d233

View file

@ -56,13 +56,13 @@ impl RedNode {
} }
fn new(green: GreenNode, parent: Option<ParentData>) -> RedNode { fn new(green: GreenNode, parent: Option<ParentData>) -> RedNode {
let start_offset = parent.as_ref().map(|it| it.start_offset).unwrap_or(0.into()); let mut start_offset = parent.as_ref().map(|it| it.start_offset).unwrap_or(0.into());
let children = green.children() let children = green.children()
.iter() .iter()
.scan(start_offset, |start_offset, child| { .map(|child| {
let res = RedChild::Zigot(*start_offset); let off = start_offset;
*start_offset += child.text_len(); start_offset += child.text_len();
Some(res) RedChild::Zigot(off)
}) })
.collect::<Vec<_>>() .collect::<Vec<_>>()
.into_boxed_slice(); .into_boxed_slice();