remove IsClause
This commit is contained in:
@@ -324,7 +324,7 @@ pub(crate) trait CallPolicy: Any {
|
||||
let b = machine_st.b - 1;
|
||||
let n = machine_st.or_stack[b].num_args();
|
||||
|
||||
for i in 1 .. n + 1 {
|
||||
for i in 1 .. n + 1 {
|
||||
machine_st.registers[i] = machine_st.or_stack[b][i].clone();
|
||||
}
|
||||
|
||||
@@ -510,11 +510,11 @@ pub(crate) trait CallPolicy: Any {
|
||||
|
||||
return_from_clause!(machine_st.last_call, machine_st)
|
||||
},
|
||||
&BuiltInClauseType::Is => {
|
||||
let a = machine_st[temp_v!(1)].clone();
|
||||
let result = machine_st.arith_eval_by_metacall(temp_v!(2))?;
|
||||
&BuiltInClauseType::Is(r, ref at) => {
|
||||
let a1 = machine_st[r].clone();
|
||||
let a2 = machine_st.get_number(at)?;
|
||||
|
||||
machine_st.unify(a, Addr::Con(Constant::Number(result)));
|
||||
machine_st.unify(a1, Addr::Con(Constant::Number(a2)));
|
||||
return_from_clause!(machine_st.last_call, machine_st)
|
||||
},
|
||||
}
|
||||
|
||||
@@ -323,7 +323,7 @@ impl MachineState {
|
||||
};
|
||||
}
|
||||
|
||||
fn get_number(&self, at: &ArithmeticTerm) -> Result<Number, MachineError> {
|
||||
pub(super) fn get_number(&self, at: &ArithmeticTerm) -> Result<Number, MachineError> {
|
||||
match at {
|
||||
&ArithmeticTerm::Reg(r) => self.arith_eval_by_metacall(r),
|
||||
&ArithmeticTerm::Interm(i) => Ok(self.interms[i-1].clone()),
|
||||
@@ -1879,15 +1879,6 @@ impl MachineState {
|
||||
|
||||
self.fail = true;
|
||||
},
|
||||
&ControlInstruction::IsClause(lco, r, ref at) => {
|
||||
self.last_call = lco;
|
||||
|
||||
let a1 = self[r].clone();
|
||||
let a2 = try_or_fail!(self, self.get_number(at));
|
||||
|
||||
self.unify(a1, Addr::Con(Constant::Number(a2)));
|
||||
try_or_fail!(self, return_from_clause!(self.last_call, self));
|
||||
},
|
||||
&ControlInstruction::JmpBy(arity, offset, _, lco) => {
|
||||
if !lco {
|
||||
self.cp.assign_if_local(self.p.clone() + 1);
|
||||
|
||||
@@ -233,7 +233,7 @@ impl Machine {
|
||||
CodePtr::Local(LocalCodePtr::DirEntry(p, _)) =>
|
||||
Some(self.code[p].clone()),
|
||||
CodePtr::BuiltInClause(built_in, _) =>
|
||||
Some(call_clause!(ClauseType::BuiltIn(built_in), built_in.arity(),
|
||||
Some(call_clause!(ClauseType::BuiltIn(built_in.clone()), built_in.arity(),
|
||||
0, self.ms.last_call)),
|
||||
CodePtr::CallN(arity, _) =>
|
||||
Some(call_clause!(ClauseType::CallN, arity, 0, self.ms.last_call))
|
||||
|
||||
Reference in New Issue
Block a user