#define ast_istype(x, t) ( ((ast_node_common*)x)->nodetype == (TYPE_##t) )
#define ast_ctx(node) (((ast_node_common*)(node))->context)
+#define ast_side_effects(node) (((ast_node_common*)(node))->side_effects)
/* Node interface with common components
*/
* prevents its dtor from destroying this node as well.
*/
bool keep;
+ bool side_effects;
} ast_node_common;
#define ast_delete(x) ( ( (ast_node*)(x) ) -> node.destroy )((ast_node*)(x))
ast_expression_common expression;
ast_expression *owner;
unsigned int field;
+ const char *name;
};
-ast_member* ast_member_new(lex_ctx ctx, ast_expression *owner, unsigned int field);
+ast_member* ast_member_new(lex_ctx ctx, ast_expression *owner, unsigned int field, const char *name);
void ast_member_delete(ast_member*);
bool ast_member_codegen(ast_member*, ast_function*, bool lvalue, ir_value**);
/* It's all just 'expressions', since an ast_block is one too. */
ast_expression *on_true;
ast_expression *on_false;
- /* After a ternary expression we find ourselves in a new IR block
- * and start with a PHI node */
- ir_value *phi_out;
};
ast_ternary* ast_ternary_new(lex_ctx ctx, ast_expression *cond, ast_expression *ontrue, ast_expression *onfalse);
void ast_ternary_delete(ast_ternary*);
bool ast_block_codegen(ast_block*, ast_function*, bool lvalue, ir_value**);
void ast_block_collect(ast_block*, ast_expression*);
+void ast_block_add_expr(ast_block*, ast_expression*);
+
/* Function
*
* Contains a list of blocks... at least in theory.