improve error handling for is/2.
This commit is contained in:
parent
ab0913a2df
commit
da4aa804a7
19
C/eval.c
19
C/eval.c
@ -144,11 +144,20 @@ BEAM_is(void)
|
|||||||
static Int
|
static Int
|
||||||
p_is(void)
|
p_is(void)
|
||||||
{ /* X is Y */
|
{ /* X is Y */
|
||||||
Term out, t;
|
Term out = 0L;
|
||||||
|
|
||||||
t = Deref(ARG2);
|
while (!(out = Eval(Deref(ARG2)))) {
|
||||||
out = Yap_FoundArithError(Eval(t), t);
|
if (Yap_Error_TYPE == RESOURCE_ERROR_STACK) {
|
||||||
if (!out) return FALSE;
|
Yap_Error_TYPE = YAP_NO_ERROR;
|
||||||
|
if (!Yap_gcl(Yap_Error_Size, 2, ENV, CP)) {
|
||||||
|
Yap_Error(RESOURCE_ERROR_STACK, ARG2, Yap_ErrorMessage);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Yap_Error(Yap_Error_TYPE, ARG2, Yap_ErrorMessage);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
return Yap_unify_constant(ARG1,out);
|
return Yap_unify_constant(ARG1,out);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -183,6 +192,6 @@ Yap_InitEval(void)
|
|||||||
Yap_InitConstExps();
|
Yap_InitConstExps();
|
||||||
Yap_InitUnaryExps();
|
Yap_InitUnaryExps();
|
||||||
Yap_InitBinaryExps();
|
Yap_InitBinaryExps();
|
||||||
Yap_InitCPred("is", 2, p_is, SafePredFlag);
|
Yap_InitCPred("is", 2, p_is, 0L);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user