Skip to content

Commit

Permalink
Merge pull request #466 from katef/sv/lx-c-codegen-guard-api_pos-fields
Browse files Browse the repository at this point in the history
lx: Add a guard for referencing `lx->end.col`, may not be in the struct.
  • Loading branch information
katef authored May 9, 2024
2 parents f945fda + 1e07cc9 commit f40c58a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/lx/print/c.c
Original file line number Diff line number Diff line change
Expand Up @@ -1118,7 +1118,9 @@ lx_print_c(FILE *f, const struct ast *ast)
fprintf(f, "{\n");
fprintf(f, "\tassert(lx != NULL);\n");
fprintf(f, "\tassert(p != NULL);\n");
fprintf(f, "\tlx->end.col = 1;\n");
if (~api_exclude & API_POS) {
fprintf(f, "\tlx->end.col = 1;\n");
}
fprintf(f, "\tlx->p = p;\n");
fprintf(f, "}\n");
}
Expand Down

0 comments on commit f40c58a

Please sign in to comment.