add predicate existence errors for failed metacalls.

This commit is contained in:
Mark Thom
2018-04-17 09:26:13 -06:00
parent 35694e7622
commit 56318b09d0

View File

@@ -426,15 +426,14 @@ pub(crate) trait CallPolicy: Any {
Ok(()) Ok(())
}, },
&ClauseType::CallN => { &ClauseType::CallN =>
if let Some((name, arity)) = machine_st.setup_call_n(arity) { if let Some((name, arity)) = machine_st.setup_call_n(arity) {
if let Some(idx) = code_dirs.get(name.clone(), arity, &machine_st.p.clone()) { if let Some(idx) = code_dirs.get(name.clone(), arity, &machine_st.p.clone()) {
return self.context_call(machine_st, name, arity, idx, lco); self.context_call(machine_st, name, arity, idx, lco)
} else { } else {
machine_st.fail = true; Err(predicate_existence_error(name, arity, machine_st.heap.h))
} }
} } else {
Ok(()) Ok(())
}, },
&ClauseType::Compare => { &ClauseType::Compare => {