check for callable before looking at predicate terms...

This commit is contained in:
Vítor Manuel de Morais Santos Costa 2009-11-18 13:13:16 +00:00
parent a316090f8c
commit c108ac508d

View File

@ -687,6 +687,7 @@ get_pred(Term t, Term tmod, char *pname)
restart: restart:
if (IsVarTerm(t)) { if (IsVarTerm(t)) {
Yap_Error(INSTANTIATION_ERROR, t0, pname);
return NULL; return NULL;
} else if (IsAtomTerm(t)) { } else if (IsAtomTerm(t)) {
return RepPredProp(Yap_GetPredPropByAtom(AtomOfTerm(t), tmod)); return RepPredProp(Yap_GetPredPropByAtom(AtomOfTerm(t), tmod));
@ -694,6 +695,10 @@ get_pred(Term t, Term tmod, char *pname)
return Yap_FindLUIntKey(IntegerOfTerm(t)); return Yap_FindLUIntKey(IntegerOfTerm(t));
} else if (IsApplTerm(t)) { } else if (IsApplTerm(t)) {
Functor fun = FunctorOfTerm(t); Functor fun = FunctorOfTerm(t);
if (IsExtensionFunctor(fun)) {
Yap_Error(TYPE_ERROR_CALLABLE, t0, pname);
return NULL;
}
if (fun == FunctorModule) { if (fun == FunctorModule) {
Term tmod = ArgOfTerm(1, t); Term tmod = ArgOfTerm(1, t);
if (IsVarTerm(tmod) ) { if (IsVarTerm(tmod) ) {