aboutsummaryrefslogtreecommitdiff
path: root/compile.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-05-21 20:54:09 -0400
committerBruce Hill <bruce@bruce-hill.com>2024-05-21 20:54:09 -0400
commit7e275af628ea2217b78c5c0cf12864728a6fc2b4 (patch)
tree4cea62a9ccf1ed5dff6191679943c2763d44a16d /compile.c
parentb1db4fd0f68ddbc357df10743b3c85d12af0bc4e (diff)
Get rid of struct constructor
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/compile.c b/compile.c
index fafbfc06..ea06ce6c 100644
--- a/compile.c
+++ b/compile.c
@@ -1704,8 +1704,7 @@ CORD compile(env_t *env, ast_t *ast)
if (t->tag == StructType) {
// Struct constructor:
fn_t = Type(FunctionType, .args=Match(t, StructType)->fields, .ret=t);
- CORD fn = compile(env, call->fn);
- return CORD_all(fn, "(", compile_arguments(env, ast, Match(fn_t, FunctionType)->args, call->args), ")");
+ return CORD_all("((", compile_type(env, t), "){", compile_arguments(env, ast, Match(fn_t, FunctionType)->args, call->args), "})");
} else if (t->tag == IntType || t->tag == NumType) {
// Int/Num constructor:
if (!call->args || call->args->next)