fix stack redirection for mixed test

This commit is contained in:
Breval Ferrari 2024-10-14 21:30:06 -04:00
parent d67f5efe48
commit b95ace9d8e
No known key found for this signature in database
GPG key ID: 6FED68D87C479A59
2 changed files with 12 additions and 12 deletions

View file

@ -18,14 +18,14 @@ fn inflate(mut flat_atoms: Vec<FlatAtom>) -> Vec<Atom> {
let mut slope_stack: Vec<Vec<Atom>> = Vec::new(); let mut slope_stack: Vec<Vec<Atom>> = Vec::new();
let mut stack_history: Vec<CurrentStack> = Vec::new(); let mut stack_history: Vec<CurrentStack> = Vec::new();
for mut atom in flat_atoms.into_iter() { for mut atom in flat_atoms.into_iter() {
// #[cfg(test)] #[cfg(test)]
// { {
// dbg!(&atom); dbg!(&atom);
// dbg!(&loop_stack); dbg!(&loop_stack);
// dbg!(&tuple_stack); dbg!(&tuple_stack);
// dbg!(&slope_stack); dbg!(&slope_stack);
// dbg!(&stack_history); dbg!(&stack_history);
// } }
if let Some(stack) = stack_history.last() { if let Some(stack) = stack_history.last() {
match CurrentStackDiscriminants::from(stack) { match CurrentStackDiscriminants::from(stack) {
CurrentStackDiscriminants::Loop => match atom { CurrentStackDiscriminants::Loop => match atom {
@ -92,7 +92,7 @@ fn inflate(mut flat_atoms: Vec<FlatAtom>) -> Vec<Atom> {
tuple_stack.last_mut().unwrap().push(Atom::QuickModifier(q)) tuple_stack.last_mut().unwrap().push(Atom::QuickModifier(q))
} }
FlatAtom::LoopStarts(n) => { FlatAtom::LoopStarts(n) => {
tuple_stack.push(Vec::new()); loop_stack.push(Vec::new());
stack_history.push(CurrentStack::Loop(n)); stack_history.push(CurrentStack::Loop(n));
} }
FlatAtom::LoopEnds => panic!("unmatched end loop in a tuple"), FlatAtom::LoopEnds => panic!("unmatched end loop in a tuple"),
@ -138,7 +138,7 @@ fn inflate(mut flat_atoms: Vec<FlatAtom>) -> Vec<Atom> {
slope_stack.last_mut().unwrap().push(Atom::QuickModifier(q)) slope_stack.last_mut().unwrap().push(Atom::QuickModifier(q))
} }
FlatAtom::LoopStarts(n) => { FlatAtom::LoopStarts(n) => {
slope_stack.push(Vec::new()); loop_stack.push(Vec::new());
stack_history.push(CurrentStack::Loop(n)); stack_history.push(CurrentStack::Loop(n));
} }
FlatAtom::LoopEnds => panic!("unmatched end loop"), FlatAtom::LoopEnds => panic!("unmatched end loop"),

View file

@ -131,14 +131,14 @@ mod inflate {
SlopeModifier::Note, SlopeModifier::Note,
instruction(), instruction(),
vec![Atom::Slope( vec![Atom::Slope(
SlopeModifier::Note, SlopeModifier::Length,
instruction(), instruction(),
vec![Atom::Note(2), Atom::Note(3)] vec![Atom::Note(2), Atom::Note(3)]
)] )]
)], )],
inflate(vec![ inflate(vec![
FlatAtom::SlopeStarts(SlopeModifier::Note, instruction()), FlatAtom::SlopeStarts(SlopeModifier::Note, instruction()),
FlatAtom::SlopeStarts(SlopeModifier::Note, instruction()), FlatAtom::SlopeStarts(SlopeModifier::Length, instruction()),
FlatAtom::Note(2), FlatAtom::Note(2),
FlatAtom::Note(3), FlatAtom::Note(3),
FlatAtom::SlopeEnds, FlatAtom::SlopeEnds,