Skip to content

Commit

Permalink
lx: Add a guard for referencing lx->end.col, may not be in the struct.
Browse files Browse the repository at this point in the history
This field doesn't exist when lx is called with `-x pos`, so don't
include references to it the generated code.
  • Loading branch information
silentbicycle committed May 9, 2024
1 parent f945fda commit 1e07cc9
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 1e07cc9

Please sign in to comment.