aboutsummaryrefslogtreecommitdiff
path: root/src/compile/expressions.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-08-29 13:32:17 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-08-29 13:32:17 -0400
commit43105107b9d1e985e9c182b904f2ac79b17fb460 (patch)
treec2dbb1c0312d410a387d8da26a2475d862b5ddcf /src/compile/expressions.c
parentd8116c27f406ac4915aaa7cdae97fb73c9847c8a (diff)
Improvements to text and inline C code formatting/parsing
Diffstat (limited to 'src/compile/expressions.c')
-rw-r--r--src/compile/expressions.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/compile/expressions.c b/src/compile/expressions.c
index 58288c50..544b7723 100644
--- a/src/compile/expressions.c
+++ b/src/compile/expressions.c
@@ -237,7 +237,8 @@ Text_t compile(env_t *env, ast_t *ast) {
case Index: return compile_indexing(env, ast);
case InlineCCode: {
type_t *t = get_type(env, ast);
- if (t->tag == VoidType) return Texts("{\n", compile_statement(env, ast), "\n}");
+ if (Match(ast, InlineCCode)->type_ast != NULL) return Texts("({", compile_statement(env, ast), "; })");
+ else if (t->tag == VoidType) return Texts("{\n", compile_statement(env, ast), "\n}");
else return compile_statement(env, ast);
}
case Use: code_err(ast, "Compiling 'use' as expression!");