diff options
| author | Zuhaitz Méndez Fernández de Aránguiz <zuhaitz@debian> | 2026-01-26 02:55:51 +0000 |
|---|---|---|
| committer | Zuhaitz Méndez Fernández de Aránguiz <zuhaitz@debian> | 2026-01-26 02:55:51 +0000 |
| commit | e310dbff40e60e878032d59fd7c550398ee34e5d (patch) | |
| tree | 5ef84fbfaf461e9253e75522a7c8798344358183 /src/codegen/codegen_main.c | |
| parent | 2022012d6514578bd53a91b3048d08cf8686e233 (diff) | |
Fixed duplicate logic and stability issues
Diffstat (limited to 'src/codegen/codegen_main.c')
| -rw-r--r-- | src/codegen/codegen_main.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/codegen/codegen_main.c b/src/codegen/codegen_main.c index 61269ef..6e66bcb 100644 --- a/src/codegen/codegen_main.c +++ b/src/codegen/codegen_main.c @@ -458,15 +458,15 @@ void codegen_node(ParserContext *ctx, ASTNode *node, FILE *out) if (ctx->parsed_globals_list) { - StructRef *s = ctx->parsed_globals_list; - while (s) + StructRef *struct_ref = ctx->parsed_globals_list; + while (struct_ref) { ASTNode *copy = xmalloc(sizeof(ASTNode)); - *copy = *s->node; + *copy = *struct_ref->node; copy->next = merged_globals; merged_globals = copy; - s = s->next; + struct_ref = struct_ref->next; } } @@ -477,11 +477,11 @@ void codegen_node(ParserContext *ctx, ASTNode *node, FILE *out) if (ctx->instantiated_funcs) { - ASTNode *s = ctx->instantiated_funcs; - while (s) + ASTNode *fn_node = ctx->instantiated_funcs; + while (fn_node) { ASTNode *copy = xmalloc(sizeof(ASTNode)); - *copy = *s; + *copy = *fn_node; copy->next = NULL; if (!merged_funcs) { @@ -493,17 +493,17 @@ void codegen_node(ParserContext *ctx, ASTNode *node, FILE *out) merged_funcs_tail->next = copy; merged_funcs_tail = copy; } - s = s->next; + fn_node = fn_node->next; } } if (ctx->parsed_funcs_list) { - StructRef *s = ctx->parsed_funcs_list; - while (s) + StructRef *fn_ref = ctx->parsed_funcs_list; + while (fn_ref) { ASTNode *copy = xmalloc(sizeof(ASTNode)); - *copy = *s->node; + *copy = *fn_ref->node; copy->next = NULL; if (!merged_funcs) { @@ -515,17 +515,17 @@ void codegen_node(ParserContext *ctx, ASTNode *node, FILE *out) merged_funcs_tail->next = copy; merged_funcs_tail = copy; } - s = s->next; + fn_ref = fn_ref->next; } } if (ctx->parsed_impls_list) { - StructRef *s = ctx->parsed_impls_list; - while (s) + StructRef *impl_ref = ctx->parsed_impls_list; + while (impl_ref) { ASTNode *copy = xmalloc(sizeof(ASTNode)); - *copy = *s->node; + *copy = *impl_ref->node; copy->next = NULL; if (!merged_funcs) { @@ -537,7 +537,7 @@ void codegen_node(ParserContext *ctx, ASTNode *node, FILE *out) merged_funcs_tail->next = copy; merged_funcs_tail = copy; } - s = s->next; + impl_ref = impl_ref->next; } } |
