allow (m:a)/i as indicator.

This commit is contained in:
Vitor Santos Costa 2019-03-31 11:45:03 +01:00
parent 3f9e57fc48
commit 4dff2ad2ec

View File

@ -1296,6 +1296,9 @@ static Int is_callable(USES_REGS1) {
* + Module:Name//Arity-2 * + Module:Name//Arity-2
* *
* if it is, it will extract the predicate's module, name, and arity. * if it is, it will extract the predicate's module, name, and arity.
*
* Note: this will now accept both mod:(a/n) and
* (mod:a)/n as valid.
*/ */
static Int get_predicate_indicator(USES_REGS1) { static Int get_predicate_indicator(USES_REGS1) {
Term G = Deref(ARG1); Term G = Deref(ARG1);
@ -1317,6 +1320,7 @@ static Int get_predicate_indicator(USES_REGS1) {
} }
if (f == FunctorSlash || f == FunctorDoubleSlash) { if (f == FunctorSlash || f == FunctorDoubleSlash) {
Term name = ArgOfTerm(1,G), arity = ArgOfTerm(2,G); Term name = ArgOfTerm(1,G), arity = ArgOfTerm(2,G);
name = Yap_YapStripModule (name, &mod);
if (IsVarTerm(name)) { if (IsVarTerm(name)) {
Yap_ThrowError(INSTANTIATION_ERROR, name, NULL); Yap_ThrowError(INSTANTIATION_ERROR, name, NULL);
} else if (!IsAtomTerm(name)) { } else if (!IsAtomTerm(name)) {