From 1df26851d73e50407a3b7c79bcdb5b0cc053fe67 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sat, 18 May 2024 16:31:34 -0400 Subject: Add syntax for "inline C(...)" --- compile.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'compile.c') diff --git a/compile.c b/compile.c index 99e7d77b..0e73eaa1 100644 --- a/compile.c +++ b/compile.c @@ -1940,7 +1940,13 @@ CORD compile(env_t *env, ast_t *ast) default: code_err(ast, "Indexing is not supported for type: %T", container_t); } } - case InlineCCode: return Match(ast, InlineCCode)->code; + case InlineCCode: { + type_t *t = get_type(env, ast); + if (t->tag == VoidType) + return CORD_all("{\n", Match(ast, InlineCCode)->code, "\n}"); + else + return Match(ast, InlineCCode)->code; + } case Use: return CORD_EMPTY; case LinkerDirective: code_err(ast, "Linker directives are not supported yet"); case Extern: code_err(ast, "Externs are not supported as expressions"); -- cgit v1.2.3