Added variable argument count to callNode

This commit is contained in:
2022-11-07 05:22:42 +00:00
parent 526efff00c
commit aec5fcab55
6 changed files with 73 additions and 51 deletions

View File

@@ -114,14 +114,15 @@ Literal callEngineNodeLiteral(EngineNode* node, Interpreter* interpreter, Litera
initLiteralArray(&arguments);
initLiteralArray(&returns);
pushLiteralArray(&arguments, n);
//feed the arguments in backwards!
if (args) {
for (int i = 0; i < args->count; i++) {
for (int i = args->count -1; i >= 0; i--) {
pushLiteralArray(&arguments, args->literals[i]);
}
}
pushLiteralArray(&arguments, n);
callLiteralFn(interpreter, fn, &arguments, &returns);
ret = popLiteralArray(&returns);