tweak head check
@@ -24,10 +24,10 @@ pub fn new() -> TermMarker<'a> {
}
}
- fn occurs_shallowly_in_head(&self, var: &'a Var, term_loc: GenContext, r: usize) -> bool
+ fn occurs_shallowly_in_head(&self, var: &'a Var, r: usize) -> bool
{
- match (term_loc, self.bindings.get(var).unwrap()) {
- (GenContext::Head, &VarData::Temp(_, _, ref tvd)) =>
+ match self.bindings.get(var).unwrap() {
+ &VarData::Temp(_, _, ref tvd) =>
tvd.use_set.contains(&(GenContext::Head, r)),
_ => false
}
@@ -304,10 +304,14 @@ pub fn mark_var<Target>(&mut self,
}
},
Level::Deep if is_new_var =>
- if self.occurs_shallowly_in_head(var, term_loc, r.reg_num()) {
+ if let GenContext::Head = term_loc {
+ if self.occurs_shallowly_in_head(var, r.reg_num()) {
target.push(Target::subterm_to_value(r));
} else {
target.push(Target::subterm_to_variable(r));
+ }
+ } else {
+ target.push(Target::subterm_to_variable(r));
},
Level::Deep =>
target.push(Target::subterm_to_value(r))
