Work in progress fixing evaluable type error terms
This commit is contained in:
parent
580bc9eb27
commit
b91c535ea3
@ -1003,14 +1003,7 @@ p_unary_is( USES_REGS1 )
|
||||
Term out;
|
||||
|
||||
if (EndOfPAEntr(p = RepExpProp(Yap_GetExpProp(name, 1)))) {
|
||||
|
||||
Term ti[2];
|
||||
|
||||
/* error */
|
||||
ti[0] = t;
|
||||
ti[1] = MkIntTerm(1);
|
||||
t = Yap_MkApplTerm(FunctorSlash, 2, ti);
|
||||
Yap_EvalError(TYPE_ERROR_EVALUABLE, t,
|
||||
Yap_EvalError(TYPE_ERROR_EVALUABLE, takeName(t),
|
||||
"functor %s/1 for arithmetic expression",
|
||||
RepAtom(name)->StrOfAE);
|
||||
return FALSE;
|
||||
|
@ -1199,13 +1199,7 @@ p_binary_is( USES_REGS1 )
|
||||
Term out;
|
||||
|
||||
if (EndOfPAEntr(p = RepExpProp(Yap_GetExpProp(name, 2)))) {
|
||||
Term ti[2];
|
||||
|
||||
/* error */
|
||||
ti[0] = t;
|
||||
ti[1] = MkIntTerm(1);
|
||||
t = Yap_MkApplTerm(FunctorSlash, 2, ti);
|
||||
Yap_EvalError(TYPE_ERROR_EVALUABLE, t,
|
||||
Yap_EvalError(TYPE_ERROR_EVALUABLE, takeName(t),
|
||||
"functor %s/2 for arithmetic expression",
|
||||
RepAtom(name)->StrOfAE);
|
||||
P = FAILCODE;
|
||||
|
16
C/eval.c
16
C/eval.c
@ -106,14 +106,6 @@ Eval(Term t USES_REGS)
|
||||
Atom name = AtomOfTerm(t);
|
||||
|
||||
if (EndOfPAEntr(p = RepExpProp(Yap_GetExpProp(name, 0)))) {
|
||||
/* error */
|
||||
Term ti[2];
|
||||
|
||||
/* error */
|
||||
ti[0] = t;
|
||||
ti[1] = MkIntTerm(0);
|
||||
t = Yap_MkApplTerm(FunctorSlash, 2, ti);
|
||||
|
||||
return Yap_ArithError(TYPE_ERROR_EVALUABLE, t,
|
||||
"atom %s in arithmetic expression",
|
||||
RepAtom(name)->StrOfAE);
|
||||
@ -137,13 +129,7 @@ Eval(Term t USES_REGS)
|
||||
Term t1, t2;
|
||||
|
||||
if (EndOfPAEntr(p = RepExpProp(Yap_GetExpProp(name, n)))) {
|
||||
Term ti[2];
|
||||
|
||||
/* error */
|
||||
ti[0] = t;
|
||||
ti[1] = MkIntegerTerm(n);
|
||||
t = Yap_MkApplTerm(FunctorSlash, 2, ti);
|
||||
return Yap_ArithError(TYPE_ERROR_EVALUABLE, t,
|
||||
return Yap_ArithError(TYPE_ERROR_EVALUABLE, takeName(t),
|
||||
"functor %s/%d for arithmetic expression",
|
||||
RepAtom(name)->StrOfAE,n);
|
||||
}
|
||||
|
7
H/eval.h
7
H/eval.h
@ -415,6 +415,13 @@ Yap_FoundArithError__(USES_REGS1)
|
||||
return YAP_NO_ERROR;
|
||||
}
|
||||
|
||||
static inline Term takeName(Term t) {
|
||||
if (IsAtomTerm(t)) return t;
|
||||
MkAtomTerm(NameOfFunctor(FunctorOfTerm(t)));
|
||||
if (IsPairTerm(t)) return TermNil;
|
||||
return t;
|
||||
}
|
||||
|
||||
Atom Yap_NameOfUnaryOp(int i);
|
||||
Atom Yap_NameOfBinaryOp(int i);
|
||||
|
||||
|
Reference in New Issue
Block a user