aboutsummaryrefslogtreecommitdiff
path: root/src/types.h
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-04-06 18:04:35 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-04-06 18:04:35 -0400
commit89754ac89dd1d568ab0ff14d145cae259d9db66f (patch)
tree14b4920231c2a4d23194f7570ab4e43fd000da3e /src/types.h
parente87e6dabfbdc1d35b5fe41b5d84dab38df3c8e76 (diff)
Make it a bit more ergonomic to make function types
Diffstat (limited to 'src/types.h')
-rw-r--r--src/types.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/types.h b/src/types.h
index 53488584..2d2bd2a3 100644
--- a/src/types.h
+++ b/src/types.h
@@ -130,6 +130,7 @@ struct type_s {
#define Type(typetag, ...) new(type_t, .tag=typetag, .__data.typetag={__VA_ARGS__})
#define INT_TYPE Type(BigIntType)
#define NUM_TYPE Type(NumType, .bits=TYPE_NBITS64)
+#define NewFunctionType(ret, ...) _make_function_type(ret, sizeof((arg_t[]){__VA_ARGS__})/sizeof(arg_t), (arg_t[]){__VA_ARGS__})
CORD type_to_cord(type_t *t);
const char *type_to_str(type_t *t);
@@ -155,5 +156,6 @@ PUREFUNC size_t unpadded_struct_size(type_t *t);
PUREFUNC type_t *non_optional(type_t *t);
type_t *get_field_type(type_t *t, const char *field_name);
PUREFUNC type_t *get_iterated_type(type_t *t);
+type_t *_make_function_type(type_t *ret, int n, arg_t args[n]);
// vim: ts=4 sw=0 et cino=L2,l1,(0,W4,m1,\:0