aboutsummaryrefslogtreecommitdiff
path: root/src/ast.h
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-12-06 14:55:00 -0500
committerBruce Hill <bruce@bruce-hill.com>2025-12-06 14:55:00 -0500
commit48491f94c96615e8055bcf72ed9009b1d921467f (patch)
treeb30b934d71ca14a7f9602282c35d2f2c137d902a /src/ast.h
parenta13b39f1e1ea220a868d99508796d06492a40611 (diff)
Use `foo!` as sugar for `foo.FirstTag!` for enum values. Also, give
better error messages for this kind of `!` assertion.
Diffstat (limited to 'src/ast.h')
-rw-r--r--src/ast.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/ast.h b/src/ast.h
index 5307fc2c..b852da2a 100644
--- a/src/ast.h
+++ b/src/ast.h
@@ -23,9 +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 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))