self->vtype = vtype;
self->name = name ? util_strdup(name) : NULL;
- self->blocks = NULL;
self->labelcount = 0;
self->builtin = 0;
for (i = 0; i < vec_size(self->static_names); ++i)
mem_d(self->static_names[i]);
vec_free(self->static_names);
- for (i = 0; i < vec_size(self->blocks); ++i)
- ast_delete(self->blocks[i]);
- vec_free(self->blocks);
+ for (auto &it : self->blocks)
+ ast_delete(it);
vec_free(self->breakblocks);
vec_free(self->continueblocks);
if (self->varargs)
ast_expression *ec;
ast_expression_codegen *cgen;
- size_t i;
-
(void)ir;
irf = self->ir_func;
return false;
}
- if (!vec_size(self->blocks)) {
+ if (self->blocks.empty()) {
compile_error(ast_ctx(self), "function `%s` has no body", self->name);
return false;
}
}
}
- for (i = 0; i < vec_size(self->blocks); ++i) {
- cgen = self->blocks[i]->expression.codegen;
- if (!(*cgen)((ast_expression*)self->blocks[i], self, false, &dummy))
+ for (auto &it : self->blocks) {
+ cgen = it->expression.codegen;
+ if (!(*cgen)((ast_expression*)it, self, false, &dummy))
return false;
}
)
);
- vec_push(func->blocks, block);
+ func->blocks.push_back(block);
intrin_reg(intrin, value, func);
return (ast_expression*)value;;
);
value->expression.params.push_back(x);
- vec_push(func->blocks, body);
+ func->blocks.push_back(body);
intrin_reg(intrin, value, func);
);
value->expression.params.push_back(arg1);
- vec_push(func->blocks, body);
+ func->blocks.push_back(body);
intrin_reg(intrin, value, func);
)
);
- vec_push(func->blocks, body);
+ func->blocks.push_back(body);
intrin_reg(intrin, value, func);
return (ast_expression*)value;
}
)
);
- vec_push(func->blocks, body);
+ func->blocks.push_back(body);
intrin_reg(intrin, value, func);
return (ast_expression*)value;
}
)
);
- vec_push(func->blocks, body);
+ func->blocks.push_back(body);
intrin_reg(intrin, value, func);
return (ast_expression*)value;
}
)
);
- vec_push(func->blocks, body);
+ func->blocks.push_back(body);
intrin_reg(intrin, value, func);
return (ast_expression*)value;
}
)
);
- vec_push(func->blocks, body);
+ func->blocks.push_back(body);
intrin_reg(intrin, value, func);
return (ast_expression*)value;
}
)
);
- vec_push(func->blocks, body);
-
+ func->blocks.push_back(body);
intrin_reg(intrin, value, func);
return (ast_expression*)value;
}
)
);
- vec_push(func->blocks, body);
-
+ func->blocks.push_back(body);
intrin_reg(intrin, value, func);
return (ast_expression*)value;
}
)
);
- vec_push(func->blocks, body);
+ func->blocks.push_back(body);
intrin_reg(intrin, value, func);
return (ast_expression*)value;
}
);
/* } */
- vec_push(func->blocks, body);
-
+ func->blocks.push_back(body);
intrin_reg(intrin, value, func);
return (ast_expression*)value;
}
)
);
- vec_push(func->blocks, body);
+ func->blocks.push_back(body);
intrin_reg(intrin, value, func);
-
return (ast_expression*)value;
}
value->expression.params.push_back(arg1);
- vec_push(func->blocks, body);
-
+ func->blocks.push_back(body);
intrin_reg(intrin, value, func);
-
return (ast_expression*)value;
}
)
);
- vec_push(func->blocks, body);
+ func->blocks.push_back(body);
intrin_reg(intrin, value, func);
-
return (ast_expression*)value;
}
)
);
- vec_push(func->blocks, block);
+ func->blocks.push_back(block);
intrin_reg(intrin, value, func);
-
return (ast_expression*)value;
}
)
);
- vec_push(func->blocks, block);
+ func->blocks.push_back(block);
intrin_reg(intrin, value, func);
-
return (ast_expression*)value;
}
)
);
- vec_push(func->blocks, block);
+ func->blocks.push_back(block);
intrin_reg(intrin, value, func);
-
return (ast_expression*)value;
}
)
);
- vec_push(func->blocks, body);
+ func->blocks.push_back(body);
intrin_reg(intrin, value, func);
return (ast_expression*)value;
}
)
);
- vec_push(func->blocks, body);
+ func->blocks.push_back(body);
intrin_reg(intrin, value, func);
return (ast_expression*)value;
}