/* If
*
- * A general 'if then else' statement, either side can be NULL and will
- * thus be omitted. It is an error for *both* cases to be NULL at once.
+ * A general 'if then else' statement, either side can be nullptr and will
+ * thus be omitted. It is an error for *both* cases to be nullptr at once.
*
* During its 'codegen' it'll be changing the ast_function's block.
*
- * An if is also an "expression". Its codegen will put NULL into the
+ * An if is also an "expression". Its codegen will put nullptr into the
* output field though. For ternary expressions an ast_ternary will be
* added.
*/
* a PHI node.
*
* The other difference is that in an ast_ternary, NEITHER side
- * must be NULL, there's ALWAYS an else branch.
+ * must be nullptr, there's ALWAYS an else branch.
*
* This is the only ast_node beside ast_value which contains
* an ir_value. Theoretically we don't need to remember it though.
{
ast_expression expression;
ast_expression *operand;
- ast_switch_case *cases;
+ std::vector<ast_switch_case> cases;
};
ast_switch* ast_switch_new(lex_ctx_t ctx, ast_expression *op);
*/
struct ast_function
{
- ast_node node;
+ ast_node node;
- ast_value *vtype;
+ ast_value *vtype;
const char *name;
int builtin;
/* list of used-up names for statics without the count suffix */
- char **static_names;
+ std::vector<char*> static_names;
/* number of static variables, by convention this includes the
* ones without the count-suffix - remember this when dealing
* with savegames. uint instead of size_t as %zu in printf is
unsigned int static_count;
ir_function *ir_func;
- ir_block *curblock;
- ir_block **breakblocks;
- ir_block **continueblocks;
+ ir_block *curblock;
+ std::vector<ir_block*> breakblocks;
+ std::vector<ir_block*> continueblocks;
- size_t labelcount;
+ size_t labelcount;
/* in order for thread safety - for the optional
* channel abesed multithreading... keeping a buffer
* here to use in ast_function_label.
*/
- char labelbuf[64];
- ast_block* *blocks;
+ char labelbuf[64];
+ std::vector<ast_block*> blocks;
ast_value *varargs;
ast_value *argc;
ast_value *fixedparams;