refine *_void emission"

This commit is contained in:
Mark Thom
2017-05-01 14:22:32 -06:00
parent 5d354bbce7
commit 9687878219
2 changed files with 26 additions and 24 deletions

View File

@@ -9,9 +9,10 @@ pub trait CompilationTarget<'a> {
fn to_constant(Level, Constant, RegType) -> Self;
fn to_list(Level, RegType) -> Self;
fn to_structure(Level, Atom, usize, RegType) -> Self;
fn to_void(usize) -> Self;
fn is_void_instr(&self) -> bool;
fn incr_void_instr(&mut self);
fn constant_subterm(Constant) -> Self;
@@ -56,6 +57,13 @@ impl<'a> CompilationTarget<'a> for FactInstruction {
}
}
fn incr_void_instr(&mut self) {
match self {
&mut FactInstruction::UnifyVoid(ref mut incr) => *incr += 1,
_ => {}
}
}
fn constant_subterm(constant: Constant) -> Self {
FactInstruction::UnifyConstant(constant)
}
@@ -114,6 +122,13 @@ impl<'a> CompilationTarget<'a> for QueryInstruction {
_ => false
}
}
fn incr_void_instr(&mut self) {
match self {
&mut QueryInstruction::SetVoid(ref mut incr) => *incr += 1,
_ => {}
}
}
fn constant_subterm(constant: Constant) -> Self {
QueryInstruction::SetConstant(constant)