self->ir_func = NULL;
self->curblock = NULL;
- self->breakblocks = NULL;
- self->continueblocks = NULL;
-
vtype->hasvalue = true;
vtype->constval.vfunc = self;
vec_free(self->static_names);
for (auto &it : self->blocks)
ast_delete(it);
- vec_free(self->breakblocks);
- vec_free(self->continueblocks);
if (self->varargs)
ast_delete(self->varargs);
if (self->argc)
/* enter */
func->curblock = bbody;
- vec_push(func->breakblocks, bbreak);
+ func->breakblocks.push_back(bbreak);
if (bcontinue)
- vec_push(func->continueblocks, bcontinue);
+ func->continueblocks.push_back(bcontinue);
else
- vec_push(func->continueblocks, bbody);
+ func->continueblocks.push_back(bbody);
/* generate */
if (self->body) {
}
end_bbody = func->curblock;
- vec_pop(func->breakblocks);
- vec_pop(func->continueblocks);
+ func->breakblocks.pop_back();
+ func->continueblocks.pop_back();
}
/* post-loop-condition */
self->expression.outr = (ir_value*)1;
if (self->is_continue)
- target = func->continueblocks[vec_size(func->continueblocks)-1-self->levels];
+ target = func->continueblocks[func->continueblocks.size()-1-self->levels];
else
- target = func->breakblocks[vec_size(func->breakblocks)-1-self->levels];
+ target = func->breakblocks[func->breakblocks.size()-1-self->levels];
if (!target) {
compile_error(ast_ctx(self), "%s is lacking a target block", (self->is_continue ? "continue" : "break"));
return false;
/* setup the break block */
- vec_push(func->breakblocks, bout);
+ func->breakblocks.push_back(bout);
/* Now create all cases */
for (auto &it : self->cases) {
func->curblock = bout;
/* restore the break block */
- vec_pop(func->breakblocks);
+ func->breakblocks.pop_back();
/* Move 'bout' to the end, it's nicer */
vec_remove(func->ir_func->blocks, bout_id, 1);