mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2025-03-22 02:31:28 +00:00
ast_block_codegen - as you can see, an ast_block doesn't actually care about ir_blocks
This commit is contained in:
parent
13082112b0
commit
307eb2d9a2
1 changed files with 31 additions and 1 deletions
32
ast.c
32
ast.c
|
@ -446,7 +446,37 @@ bool ast_function_codegen(ast_function *self, ir_builder *ir)
|
|||
|
||||
bool ast_block_codegen(ast_block *self, ast_function *func, bool lvalue, ir_value **out)
|
||||
{
|
||||
return false;
|
||||
size_t i;
|
||||
|
||||
/* We don't use this
|
||||
* Note: an ast-representation using the comma-operator
|
||||
* of the form: (a, b, c) = x should not assign to c...
|
||||
*/
|
||||
(void)lvalue;
|
||||
|
||||
/* output is NULL at first, we'll have each expression
|
||||
* assign to out output, thus, a comma-operator represention
|
||||
* using an ast_block will return the last generated value,
|
||||
* so: (b, c) + a executed both b and c, and returns c,
|
||||
* which is then added to a.
|
||||
*/
|
||||
*out = NULL;
|
||||
|
||||
/* generate locals */
|
||||
for (i = 0; i < self->locals_count; ++i)
|
||||
{
|
||||
if (!ast_local_codegen(self->locals[i], func->ir_func))
|
||||
return false;
|
||||
}
|
||||
|
||||
for (i = 0; i < self->exprs_count; ++i)
|
||||
{
|
||||
ast_expression_codegen *gen = self->exprs[i]->expression.codegen;
|
||||
if (!(*gen)(self->exprs[i], func, false, out))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ast_store_codegen(ast_store *self, ast_function *func, bool lvalue, ir_value **out)
|
||||
|
|
Loading…
Reference in a new issue