/* AST codegen aprt
*/
-bool ast_value_codegen(ast_value *self, ast_function *func, ir_value **out)
+bool ast_value_codegen(ast_value *self, ast_function *func, bool lvalue, ir_value **out)
{
/* NOTE: This is the codegen for a variable used in an expression.
* It is not the codegen to generate the value. For this purpose,
return false;
}
-bool ast_block_codegen(ast_block *self, ast_function *func, ir_value **out)
+bool ast_block_codegen(ast_block *self, ast_function *func, bool lvalue, ir_value **out)
{
return false;
}
-bool ast_store_codegen(ast_store *self, ast_function *func, ir_value **out)
+bool ast_store_codegen(ast_store *self, ast_function *func, bool lvalue, ir_value **out)
{
return false;
}
-bool ast_binary_codegen(ast_binary *self, ast_function *func, ir_value **out)
+bool ast_binary_codegen(ast_binary *self, ast_function *func, bool lvalue, ir_value **out)
{
return false;
}
-bool ast_entfield_codegen(ast_entfield *self, ast_function *func, ir_value **out)
+bool ast_entfield_codegen(ast_entfield *self, ast_function *func, bool lvalue, ir_value **out)
{
return false;
}
*/
typedef bool ast_expression_codegen(ast_expression*,
ast_function*,
+ bool lvalue,
ir_value**);
typedef struct
{
bool ast_value_set_name(ast_value*, const char *name);
-bool ast_value_codegen(ast_value*, ast_function*, ir_value**);
+bool ast_value_codegen(ast_value*, ast_function*, bool lvalue, ir_value**);
/* Binary
*
ast_expression *right);
void ast_binary_delete(ast_binary*);
-/* hmm, seperate functions?
-bool ast_block_codegen(ast_block*, ast_function*, ir_value**);
- */
-bool ast_binary_codegen(ast_binary*, ast_function*, ir_value**);
+bool ast_binary_codegen(ast_binary*, ast_function*, bool lvalue, ir_value**);
/* Entity-field
*
ast_entfield* ast_entfield_new(lex_ctx ctx, ast_expression *entity, ast_expression *field);
void ast_entfield_delete(ast_entfield*);
-bool ast_entfield_codegen(ast_entfield*, ast_function*, ir_value**);
+bool ast_entfield_codegen(ast_entfield*, ast_function*, bool lvalue, ir_value**);
/* Store
*
ast_value *d, ast_expression *s);
void ast_store_delete(ast_store*);
-bool ast_store_codegen(ast_store*, ast_function*, ir_value**);
+bool ast_store_codegen(ast_store*, ast_function*, bool lvalue, ir_value**);
/* Blocks
*
MEM_VECTOR_PROTO(ast_block, ast_value*, locals);
MEM_VECTOR_PROTO(ast_block, ast_expression*, exprs);
-bool ast_block_codegen(ast_block*, ast_function*, ir_value**);
+bool ast_block_codegen(ast_block*, ast_function*, bool lvalue, ir_value**);
/* Function
*