bug fixes
This commit is contained in:
@@ -14,7 +14,7 @@ GroundProgram _GroundProgramPreprocess(GroundProgram* program, GroundState* stat
|
||||
GroundInstruction* sig = &program->at[i];
|
||||
char* id = sig->args.at[0].as.ref->string;
|
||||
|
||||
for (GroundSize j = 1; i < sig->args.len - 1; i++) {
|
||||
for (GroundSize j = 1; j < sig->args.len; j++) {
|
||||
GroundArg* arg = &sig->args.at[j];
|
||||
|
||||
// Ignore type annotations, this can be taken care of in another function
|
||||
@@ -23,6 +23,16 @@ GroundProgram _GroundProgramPreprocess(GroundProgram* program, GroundState* stat
|
||||
}
|
||||
char* argId = arg->as.ref->string;
|
||||
Ground.Function.appendArg(&function, argId);
|
||||
|
||||
GroundVariable* argVar = malloc(sizeof(GroundVariable));
|
||||
if (argVar == NULL) {
|
||||
Ground.Flags.error = true;
|
||||
Ground.Log.Error("malloc failed in Ground.Program.Preprocess");
|
||||
return newProgram;
|
||||
}
|
||||
snprintf(argVar->name, 2047, "%s", argId);
|
||||
argVar->value = Ground.New.Value.Int(0);
|
||||
HASH_ADD_STR(function.closure->variables, name, argVar);
|
||||
}
|
||||
|
||||
// Add instructions to function
|
||||
|
||||
Reference in New Issue
Block a user