cool stuff

This commit is contained in:
2026-06-15 20:27:50 +10:00
parent 284b08b12a
commit 80140ed798
41 changed files with 470 additions and 4 deletions

View File

@@ -3,12 +3,14 @@
void _GroundFunctionAppendArg(GroundFunction* function, const char* argName) {
if (function->isNativeFunction) {
Ground.Log.Error("Cannot add arg to native function in Ground.Function.appendArg()");
Ground.Flags.error = true;
return;
}
if (function->args.count + 1 >= function->args.capacity) {
GroundFunctionArg* tmp = realloc(function->args.at, sizeof(GroundFunctionArg) * function->args.capacity * 2);
if (tmp == NULL) {
Ground.Log.Error("malloc failed in Ground.Function.appendArg()");
Ground.Flags.error = true;
return;
}
@@ -20,6 +22,7 @@ void _GroundFunctionAppendArg(GroundFunction* function, const char* argName) {
size_t len = strlen(argName);
function->args.at[function->args.count].as.id = malloc(sizeof(char) * (len + 1));
if (function->args.at[function->args.count].as.id == NULL) {
Ground.Log.Error("malloc failed in Ground.Function.appendArg()");
Ground.Flags.error = true;
return;
}

View File

@@ -2,6 +2,7 @@
void _GroundFunctionAppendInstruction(GroundFunction* function, GroundInstruction instruction) {
if (function->isNativeFunction) {
Ground.Log.Error("Cannot add instruction to native function in Ground.Function.appendInstruction()");
Ground.Flags.error = true;
return;
}