break;
case TYPE_FUNCTION:
/* unlink us from the function node */
- self->constval.vfunc->vtype = nullptr;
+ self->constval.vfunc->function_type = nullptr;
break;
/* NOTE: delete function? currently collected in
* the parser structure
goto cleanup;
}
- self->vtype = vtype;
- self->name = name ? util_strdup(name) : nullptr;
+ self->function_type = vtype;
+ self->name = name ? util_strdup(name) : nullptr;
self->labelcount = 0;
self->builtin = 0;
{
if (self->name)
mem_d((void*)self->name);
- if (self->vtype) {
- /* ast_value_delete(self->vtype); */
- self->vtype->hasvalue = false;
- self->vtype->constval.vfunc = nullptr;
+ if (self->function_type) {
+ /* ast_value_delete(self->function_type); */
+ self->function_type->hasvalue = false;
+ self->function_type->constval.vfunc = nullptr;
/* We use unref - if it was stored in a global table it is supposed
* to be deleted from *there*
*/
- ast_unref(self->vtype);
+ ast_unref(self->function_type);
}
for (auto &it : self->static_names)
mem_d(it);
}
/* fill the parameter list */
- ec = &self->vtype->expression;
+ ec = &self->function_type->expression;
for (auto &it : ec->params) {
if (it->expression.vtype == TYPE_FIELD)
vec_push(irf->params, it->expression.next->vtype);
/* TODO: check return types */
if (!self->curblock->final)
{
- if (!self->vtype->expression.next ||
- self->vtype->expression.next->vtype == TYPE_VOID)
+ if (!self->function_type->expression.next ||
+ self->function_type->expression.next->vtype == TYPE_VOID)
{
return ir_block_create_return(self->curblock, ast_ctx(self), nullptr);
}
ast_value *fun;
if (!parser->function)
return nullptr;
- fun = parser->function->vtype;
+ fun = parser->function->function_type;
for (auto &it : fun->expression.params) {
if (!strcmp(it->name, name))
return (ast_expression*)it;
for (i = 0; i < paramcount; ++i)
call->params.push_back(sy->out[fid+1 + i].out);
sy->out.erase(sy->out.end() - paramcount, sy->out.end());
- (void)!ast_call_check_types(call, parser->function->vtype->expression.varparam);
+ (void)!ast_call_check_types(call, parser->function->function_type->expression.varparam);
if (parser->max_param_count < paramcount)
parser->max_param_count = paramcount;
{
ast_expression *idx, *out;
ast_value *typevar;
- ast_value *funtype = parser->function->vtype;
+ ast_value *funtype = parser->function->function_type;
lex_ctx_t ctx = parser_ctx(parser);
if (!parser->function->varargs) {
ast_expression *var = nullptr;
ast_return *ret = nullptr;
ast_value *retval = parser->function->return_value;
- ast_value *expected = parser->function->vtype;
+ ast_value *expected = parser->function->function_type;
lex_ctx_t ctx = parser_ctx(parser);
return true;
}
- cov = func->vtype;
+ cov = func->function_type;
expr = (ast_expression*)cov;
if (expr->vtype != TYPE_FUNCTION || expr->params.size()) {
*/
for (auto &f : parser->functions) {
if (f->varargs) {
- if (parser->max_param_count > f->vtype->expression.params.size()) {
- f->varargs->expression.count = parser->max_param_count - f->vtype->expression.params.size();
+ if (parser->max_param_count > f->function_type->expression.params.size()) {
+ f->varargs->expression.count = parser->max_param_count - f->function_type->expression.params.size();
if (!parser_create_array_setter_impl(parser, f->varargs)) {
con_out("failed to generate vararg setter for %s\n", f->name);
ir_builder_delete(ir);