implement if.else()

This commit is contained in:
suchmememanyskill
2021-07-09 23:46:21 +02:00
parent 623634b515
commit 65a28d8ef6
8 changed files with 55 additions and 10 deletions

View File

@@ -15,7 +15,6 @@
ClassFunction(stdIf) {
s64 value = getIntValue(args[0]);
if (value) {
Variable_t* res = genericCallDirect(args[1], NULL, 0);
if (res == NULL)
@@ -24,10 +23,11 @@ ClassFunction(stdIf) {
removePendingReference(res);
}
return &emptyClass;
}
Variable_t* ret = newIntVariablePtr(value);
ret->variableType = ElseClass;
// TODO: implement else by making if return a class that is else-able
return ret;
}
ClassFunction(stdWhile) {
Variable_t* result = eval(args[0]->function.function.operations.data, args[0]->function.function.operations.count, 1);