Don't force inline C code to use ({...})
This commit is contained in:
parent
7d80ca48d4
commit
ed6418902c
@ -1754,10 +1754,7 @@ static CORD _compile_statement(env_t *env, ast_t *ast)
|
||||
case Extern: return CORD_EMPTY;
|
||||
case InlineCCode: {
|
||||
auto inline_code = Match(ast, InlineCCode);
|
||||
if (inline_code->type)
|
||||
return CORD_all("({ ", inline_code->code, "; })");
|
||||
else
|
||||
return inline_code->code;
|
||||
return inline_code->code;
|
||||
}
|
||||
case Use: {
|
||||
auto use = Match(ast, Use);
|
||||
@ -3832,7 +3829,7 @@ CORD compile(env_t *env, ast_t *ast)
|
||||
if (t->tag == VoidType)
|
||||
return CORD_all("{\n", Match(ast, InlineCCode)->code, "\n}");
|
||||
else
|
||||
return CORD_all("({ ", Match(ast, InlineCCode)->code, "; })");
|
||||
return Match(ast, InlineCCode)->code;
|
||||
}
|
||||
case Use: code_err(ast, "Compiling 'use' as expression!");
|
||||
case Defer: code_err(ast, "Compiling 'defer' as expression!");
|
||||
|
@ -2401,6 +2401,8 @@ PARSER(parse_inline_c) {
|
||||
parser_err(ctx, start, start+1, "I couldn't find the closing '}' for this inline C code");
|
||||
|
||||
CORD c_code = GC_strndup(c_code_start, (size_t)((pos-1) - c_code_start));
|
||||
if (type)
|
||||
c_code = CORD_all("({ ", c_code, "; })");
|
||||
return NewAST(ctx->file, start, pos, InlineCCode, .code=c_code, .type_ast=type);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user