Skip to content

Commit 1b92dda

Browse files
Chore: Revert irrelevant changes in merge_atom_chunks
1 parent 95df05c commit 1b92dda

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

src/ops/functions/split_recursively.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -583,18 +583,15 @@ impl<'t, 's: 't> RecursiveChunker<'s> {
583583

584584
fn merge_atom_chunks(&self, atom_chunks: Vec<AtomChunk>) -> Vec<ChunkOutput<'s>> {
585585
struct AtomRoutingPlan {
586-
start_idx: usize,
587-
prev_plan_idx: usize,
586+
start_idx: usize, // index of `atom_chunks` for the start chunk
587+
prev_plan_idx: usize, // index of `plans` for the previous plan
588588
cost: usize,
589589
overlap_cost_base: usize,
590590
}
591591
type PrevPlanCandidate = (std::cmp::Reverse<usize>, usize); // (cost, start_idx)
592592

593-
if atom_chunks.is_empty() || atom_chunks.len() == 1 {
594-
return Vec::new();
595-
}
596-
597593
let mut plans = Vec::with_capacity(atom_chunks.len());
594+
// Janitor
598595
plans.push(AtomRoutingPlan {
599596
start_idx: 0,
600597
prev_plan_idx: 0,
@@ -702,9 +699,8 @@ impl<'t, 's: 't> RecursiveChunker<'s> {
702699

703700
start_idx -= 1;
704701
internal_syntax_level =
705-
internal_syntax_level.min(atom_chunks[start_idx + 1].boundary_syntax_level);
706-
internal_lb_level =
707-
internal_lb_level.max(atom_chunks[start_idx + 1].internal_lb_level);
702+
internal_syntax_level.min(start_chunk.boundary_syntax_level);
703+
internal_lb_level = internal_lb_level.max(start_chunk.internal_lb_level);
708704
}
709705
plans.push(AtomRoutingPlan {
710706
start_idx: arg_min_start_idx,

0 commit comments

Comments
 (0)