Function calls, with args and single returns are working

This commit is contained in:
2022-08-26 01:48:26 +01:00
parent 041fe99e01
commit a4f1e048e9
11 changed files with 316 additions and 83 deletions

View File

@@ -76,6 +76,10 @@ void freeNode(Node* node) {
FREE_ARRAY(Node, node->fnCollection.nodes, node->fnCollection.capacity);
break;
case NODE_FN_CALL:
freeNode(node->fnCall.arguments);
break;
case NODE_PATH_IF:
case NODE_PATH_WHILE:
case NODE_PATH_FOR:
@@ -198,6 +202,15 @@ void emitNodeFnDecl(Node** nodeHandle, Literal identifier, Node* arguments, Node
*nodeHandle = tmp;
}
void emitFnCall(Node** nodeHandle, Node* arguments) {
Node* tmp = ALLOCATE(Node, 1);
tmp->type = NODE_FN_CALL;
tmp->fnCall.arguments = arguments;
*nodeHandle = tmp;
}
void emitNodeFnCollection(Node** nodeHandle) {
Node* tmp = ALLOCATE(Node, 1);