Closures work

This commit is contained in:
2022-08-26 03:54:58 +01:00
parent 0c67ce6476
commit ffc50ceafb
4 changed files with 62 additions and 11 deletions

View File

@@ -823,7 +823,7 @@ static bool execFnCall(Interpreter* interpreter) {
Literal ret = popLiteralArray(&returns);
//check the return types
if (AS_TYPE(returnArray->literals[i]).typeOf != ret.type) {
if (returnArray->count > 0 && AS_TYPE(returnArray->literals[i]).typeOf != ret.type) {
printf(ERROR "ERROR: bad type found in return value\n" RESET);
//free, and skip out
@@ -1066,7 +1066,6 @@ static void execInterpreter(Interpreter* interpreter) {
}
}
static void readInterpreterSections(Interpreter* interpreter) {
//data section
const short literalCount = readShort(interpreter->bytecode, &interpreter->count);