aboutsummaryrefslogtreecommitdiff
path: root/src/tree
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-01-07 11:56:08 +0000
committerAleksey Kladov <[email protected]>2018-01-07 11:56:08 +0000
commit9e4052cc2ee12751ba94909ff479bd03df141ac4 (patch)
tree2e7c3a063369c5151fd851910c997e5d1020a164 /src/tree
parent18f9e50b2d1aaf91992be9fd2f2a7e1866a943d3 (diff)
Test utils
Diffstat (limited to 'src/tree')
-rw-r--r--src/tree/file_builder.rs9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/tree/file_builder.rs b/src/tree/file_builder.rs
index b07f4027b..37bd5b2c8 100644
--- a/src/tree/file_builder.rs
+++ b/src/tree/file_builder.rs
@@ -73,7 +73,9 @@ impl FileBuilder {
73 pub fn finish(self) -> File { 73 pub fn finish(self) -> File {
74 assert!( 74 assert!(
75 self.in_progress.is_empty(), 75 self.in_progress.is_empty(),
76 "some nodes in FileBuilder are unfinished" 76 "some nodes in FileBuilder are unfinished: {:?}",
77 self.in_progress.iter().map(|&(idx, _)| self.nodes[idx].kind)
78 .collect::<Vec<_>>()
77 ); 79 );
78 assert!( 80 assert!(
79 self.pos == (self.text.len() as u32).into(), 81 self.pos == (self.text.len() as u32).into(),
@@ -122,11 +124,6 @@ impl FileBuilder {
122 let idx = self.current_id(); 124 let idx = self.current_id();
123 &mut self.nodes[idx] 125 &mut self.nodes[idx]
124 } 126 }
125
126 fn current_sibling(&mut self) -> Option<&mut NodeData> {
127 let idx = self.in_progress.last().unwrap().1?;
128 Some(&mut self.nodes[idx])
129 }
130} 127}
131 128
132fn fill<T>(slot: &mut Option<T>, value: T) { 129fn fill<T>(slot: &mut Option<T>, value: T) {