Refactor fn arg checking
This commit is contained in:
@@ -1753,7 +1753,8 @@ GroundValue interpretGroundInstruction(GroundInstruction inst, GroundScope* scop
|
||||
if (in->args.args[i + 1].type != VALUE) {
|
||||
runtimeError(ARG_TYPE_MISMATCH, "Expecting a Value", in, currentInstruction);
|
||||
}
|
||||
if (in->args.args[i + 1].value.value.type != function->args[i].type) {
|
||||
//if (in->args.args[i + 1].value.value.type != function->args[i].type) {
|
||||
if (!checkFnTypes(&in->args.args[i + 1].value.value, &function->args[i])) {
|
||||
runtimeError(ARG_TYPE_MISMATCH, "Mismatched function argument types", in, currentInstruction);
|
||||
}
|
||||
appendToList(&argsList, in->args.args[i + 1].value.value);
|
||||
@@ -1781,7 +1782,8 @@ GroundValue interpretGroundInstruction(GroundInstruction inst, GroundScope* scop
|
||||
if (in->args.args[i + 1].type != VALUE) {
|
||||
runtimeError(ARG_TYPE_MISMATCH, "Expecting a Value", in, currentInstruction);
|
||||
}
|
||||
if (in->args.args[i + 1].value.value.type != function->args[i].type) {
|
||||
//if (in->args.args[i + 1].value.value.type != function->args[i].type) {
|
||||
if (!checkFnTypes(&in->args.args[i + 1].value.value, &function->args[i])) {
|
||||
runtimeError(ARG_TYPE_MISMATCH, "Mismatched function argument types", in, currentInstruction);
|
||||
}
|
||||
addVariable(newScope.variables, function->args[i].name, in->args.args[i + 1].value.value);
|
||||
|
||||
Reference in New Issue
Block a user