Use plfunc name in type-error messages.
Previously used the name of the C function.
This commit is contained in:
parent
deca6045ff
commit
abaf3a1ddc
|
@ -528,9 +528,9 @@ Object typeCheck(const char* funcName, Object* params, int length,
|
|||
}
|
||||
|
||||
for (int i = 0; i < typeLength - 1; i++) {
|
||||
if (typeChecks[i].checkFunc && !typeChecks[i].checkFunc(params[i])) { // TODO: Use pl func name instead of C function name.
|
||||
if (typeChecks[i].checkFunc && !typeChecks[i].checkFunc(params[i])) {
|
||||
char context[128];
|
||||
sprintf(context, "When calling %s, expected %s, but received %s", funcName, typeChecks[i].name, getTypeName(¶ms[i]));
|
||||
sprintf(context, "When calling (%s), expected %s, but received %s.", funcName, typeChecks[i].name, getTypeName(¶ms[i]));
|
||||
return errorWithContextLineNo(BAD_PARAMS, context, 0, NULL);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ Object typeCheck(const char* funcName, Object* params, int length,
|
|||
#endif
|
||||
|
||||
#ifndef DISABLE_TYPE_CHECKS
|
||||
#define checkTypes(FUNC) int FAILED; Object ERROR = typeCheck(#FUNC, params, length, FUNC ## TypeChecks, array_length(FUNC ## TypeChecks), &FAILED); \
|
||||
#define checkTypes(FUNC) int FAILED; Object ERROR = typeCheck(FUNC ## Symbol, params, length, FUNC ## TypeChecks, array_length(FUNC ## TypeChecks), &FAILED); \
|
||||
if (FAILED) { \
|
||||
return ERROR; \
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue