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