Skip to content

Conversation

@jserv
Copy link
Collaborator

@jserv jserv commented Aug 15, 2025

This commit changed read_body_statement() to use read_partial_var_decl() instead of read_full_var_decl when the type is already known, preventing double-parsing of struct types which was causing "Could not find type struct " errors at src/parser.c:728.

The root cause was that read_body_statement() had already consumed the struct type token via find_type(), but read_full_var_decl() attempted to parse the type again, leading to a token mismatch. Using read_partial_var_decl() correctly parses only the variable name when the type is already known.

Summary by Bito

This pull request fixes a critical bug in struct variable declaration handling by updating the read_body_statement() function to use read_partial_var_decl(). This change prevents double-parsing of struct types, enhancing type recognition. A comprehensive suite of tests has also been added to validate struct variable declarations across various scenarios.

This commit changed read_body_statement() to use read_partial_var_decl()
instead of read_full_var_decl when the type is already known, preventing
double-parsing of struct types which was causing "Could not find type
struct <name>" errors at src/parser.c:728.

The root cause was that read_body_statement() had already consumed
the struct type token via find_type(), but read_full_var_decl()
attempted to parse the type again, leading to a token mismatch.
Using read_partial_var_decl() correctly parses only the variable
name when the type is already known.
@jserv jserv merged commit fb100c0 into master Aug 15, 2025
12 checks passed
@jserv jserv deleted the struct-decl branch August 15, 2025 19:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants