diff --git a/src/New/BytecodeValue.c b/src/New/BytecodeValue.c index f3cb70e..0b075c5 100644 --- a/src/New/BytecodeValue.c +++ b/src/New/BytecodeValue.c @@ -31,7 +31,7 @@ static inline GroundBytecodeFunction doFunction(GroundFunction* function) { } // Create a state with function paramaters as first things inside state - GroundState state = {NULL, NULL, NULL, 0}; + GroundState state = {NULL, NULL, NULL, bf.args.count}; for (GroundSize i = 0; i < bf.args.count; i++) { GroundVariable* var = malloc(sizeof(GroundVariable)); if (var == NULL) { @@ -40,6 +40,7 @@ static inline GroundBytecodeFunction doFunction(GroundFunction* function) { return bf; } snprintf(var->name, 2047, "%s", function->args.at[i].as.id->string); + var->_offset = i; HASH_ADD_STR(state.variables, name, var); }