object initialisation

This commit is contained in:
2026-07-08 12:06:18 +10:00
parent b507d79804
commit 6929f055de
4 changed files with 50 additions and 55 deletions

View File

@@ -110,12 +110,12 @@ static inline GroundSize doOffsets(GroundProgram* gp, GroundState* state, Ground
s->offset = i++;
}
// Now go through and add offsets to everything
for (GroundSize j = 0; j < inst->args.len; j++) {
// Now go through and add offsets to everything (skip struct name at index 0)
for (GroundSize j = 1; j < inst->args.len; j++) {
// struct field name
GroundArg* arg = &inst->args.at[j];
GroundObjectField* field = NULL;
HASH_FIND_STR(state->variables, arg->as.ref->string, field);
HASH_FIND_STR(gs->fields, arg->as.ref->string, field);
if (field == NULL) {
Ground.Log.Error("unexpected null struct field in Ground.New.Bytecode -> doOffsets");
Ground.Flags.error = true;