Fixed uninitialised memory bug

This commit is contained in:
VegOwOtenks 2024-10-08 11:12:48 +02:00
parent 4259c1940c
commit fcdbc8e6a9

View file

@ -79,7 +79,6 @@ int Interpreter_ParseFunction(Interpreter* self, CallFrame* top_frame, size_t st
Token* function_name = Interpreter_GetToken(self, top_frame->instruction_pointer);
memset(f, 0, sizeof(*f));
f->name = function_name->get.identifier;
top_frame->instruction_pointer++;
@ -87,6 +86,7 @@ int Interpreter_ParseFunction(Interpreter* self, CallFrame* top_frame, size_t st
top_frame->instruction_pointer++;
Token* parameter_type = Interpreter_ExpectToken(self, top_frame, stop_index);
f->parameters = NULL;
ParameterDefinition** pdef = &f->parameters;
while (parameter_type->type != TOKENTYPE_ARROW) {
top_frame->instruction_pointer++;
@ -109,6 +109,7 @@ int Interpreter_ParseFunction(Interpreter* self, CallFrame* top_frame, size_t st
(*pdef)->type = parameter_type->get.identifier;
(*pdef)->name = parameter_name->get.identifier;
(*pdef)->next = NULL;
pdef = &((*pdef)->next);
parameter_type = Interpreter_ExpectToken(self, top_frame, stop_index);