diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-05-18 16:31:34 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-05-18 16:31:34 -0400 |
| commit | 1df26851d73e50407a3b7c79bcdb5b0cc053fe67 (patch) | |
| tree | c2e3c393b30ab34d782fd6839100c6854abd7e91 /compile.c | |
| parent | e439fcd1e2090ff797b46c80c6264f08ea9e9cfb (diff) | |
Add syntax for "inline C(...)"
Diffstat (limited to 'compile.c')
| -rw-r--r-- | compile.c | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -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"); |
