diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2025-11-26 21:12:11 -0500 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2025-11-26 21:12:11 -0500 |
| commit | 3ad07260f369dc285e5ae856b78a58c3b13ee622 (patch) | |
| tree | 7ba216c5482147ac53edaca62389029c34b4a66c /src/ast.h | |
| parent | a21f9ddfd05c643049c22bb52ab3a60f41933492 (diff) | |
Close loophole in `when` statements that allowed mutating inner field
members
Diffstat (limited to 'src/ast.h')
| -rw-r--r-- | src/ast.h | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -23,6 +23,9 @@ #define LiteralCode(code, ...) \ new (ast_t, .tag = InlineCCode, \ .__data.InlineCCode = {.chunks = new (ast_list_t, .ast = FakeAST(TextLiteral, code)), __VA_ARGS__}) +#define WrapLiteralCode(ast, code, ...) \ + new (ast_t, .tag = InlineCCode, .file = (ast)->file, .start = (ast)->start, .end = (ast)->end, \ + .__data.InlineCCode = {.chunks = new (ast_list_t, .ast = WrapAST(ast, TextLiteral, code)), __VA_ARGS__}) #define Match(x, _tag) \ ((x)->tag == _tag ? &(x)->__data._tag \ : (errx(1, __FILE__ ":%d This was supposed to be a " #_tag "\n", __LINE__), &(x)->__data._tag)) |
