introduce bind_fn, use in applicable Fact/Query instructions (#841)

This commit is contained in:
Mark Thom
2021-02-28 16:19:06 -07:00
parent 08e2b601f1
commit 3f1cfd2995
3 changed files with 48 additions and 20 deletions

View File

@@ -304,6 +304,7 @@ pub(crate) struct MachineState {
pub(crate) global_clock: usize,
pub(crate) dynamic_mode: FirstOrNext,
pub(crate) unify_fn: fn(&mut MachineState, Addr, Addr),
pub(crate) bind_fn: fn(&mut MachineState, Ref, Addr),
}
impl fmt::Debug for MachineState {
@@ -343,6 +344,14 @@ impl fmt::Debug for MachineState {
} else {
&"MachineState::unify_with_occurs_check_with_error"
})
.field("bind_fn",
if self.bind_fn as usize == MachineState::bind as usize {
&"MachineState::bind"
} else if self.bind_fn as usize == MachineState::bind_with_occurs_check_wrapper as usize {
&"MachineState::bind_with_occurs_check"
} else {
&"MachineState::bind_with_occurs_check_with_error_wrapper"
})
.finish()
}
}