...
 
Commits (2)
...@@ -363,7 +363,11 @@ impl<'s> CTreeOptimize for preprocess::Strategy<'s> { ...@@ -363,7 +363,11 @@ impl<'s> CTreeOptimize for preprocess::Strategy<'s> {
strats2.push(strat); strats2.push(strat);
} }
Strategy::Seq(strats2.into_boxed_slice()) if strats2.is_empty() {
Strategy::Id
} else {
Strategy::Seq(strats2.into_boxed_slice())
}
} }
Strategy::GuardedLChoice(pairs, final_else) => { Strategy::GuardedLChoice(pairs, final_else) => {
use std::rc::Rc; use std::rc::Rc;
......
...@@ -421,13 +421,15 @@ impl<'a> ATermWrite for Strategy<'a> { ...@@ -421,13 +421,15 @@ impl<'a> ATermWrite for Strategy<'a> {
write!(writer, "{}", str::repeat(")", pairs.len())) write!(writer, "{}", str::repeat(")", pairs.len()))
} }
Strategy::ConsMatch(ref map, ref final_else) => { Strategy::ConsMatch(ref map, ref final_else) => {
for strat in map.values() { let strat = map.values().fold(final_else.clone(), |else_strat, glc| {
write!(writer, "GuardedLChoice(")?; match *glc {
strat.to_ascii(writer)?; Strategy::GuardedLChoice(ref pairs, _) => {
write!(writer, ",Id,")?; Rc::new(Strategy::GuardedLChoice(pairs.clone(), else_strat))
} }
final_else.to_ascii(writer)?; _ => unreachable!("ConsMatch should have GuardedLChoices"),
write!(writer, "{}", str::repeat(")", map.len())) }
});
strat.to_ascii(writer)
} }
Strategy::PrimT(name, ref sargs, ref targs) => { Strategy::PrimT(name, ref sargs, ref targs) => {
write!(writer, "PrimT(")?; write!(writer, "PrimT(")?;
......