Adapting to changes of where parameters are stored in master

This commit is contained in:
Wolfgang Bumiller 2012-07-27 15:26:48 +02:00
parent e417eb2b33
commit 0a5e5c07e5

View file

@ -97,9 +97,9 @@ ast_value* parser_find_local(parser_t *parser, const char *name, size_t upto)
return parser->locals[i]; return parser->locals[i];
} }
fun = parser->function->vtype; fun = parser->function->vtype;
for (i = 0; i < fun->params_count; ++i) { for (i = 0; i < fun->expression.params_count; ++i) {
if (!strcmp(fun->params[i]->name, name)) if (!strcmp(fun->expression.params[i]->name, name))
return fun->params[i]; return fun->expression.params[i];
} }
return NULL; return NULL;
} }
@ -179,7 +179,7 @@ static ast_value *parser_parse_type(parser_t *parser, int basetype, bool *isfunc
var = ast_value_new(ctx, "<unnamed>", vtype); var = ast_value_new(ctx, "<unnamed>", vtype);
if (!var) if (!var)
goto on_error; goto on_error;
MEM_VECTOR_MOVE(&params, p, var, params); MEM_VECTOR_MOVE(&params, p, &var->expression, params);
return var; return var;
on_error: on_error:
for (i = 0; i < params.p_count; ++i) for (i = 0; i < params.p_count; ++i)
@ -502,16 +502,13 @@ static bool parser_close_call(parser_t *parser, shunt *sy)
} }
if (!fun->expression.next) { if (!fun->expression.next) {
parseerror(parser, "could not determine function parameters"); parseerror(parser, "could not determine function return type");
return false; return false;
} else { } else {
/* if (fun->expression.params_count != paramcount) {
ast_value *v = (ast_value*)(fun->expression.next); parseerror(parser, "expected %i parameters, got %i", (int)fun->expression.params_count, paramcount);
if (v->params_count != paramcount) {
parseerror(parser, "expected %i parameters, got %i", (int)v->params_count, paramcount);
return false; return false;
} }
*/
} }
return true; return true;
@ -860,7 +857,7 @@ static bool parser_variable(parser_t *parser, ast_block *localblock)
} }
fval->expression.next = (ast_expression*)var; fval->expression.next = (ast_expression*)var;
MEM_VECTOR_MOVE(var, params, fval, params); MEM_VECTOR_MOVE(&var->expression, params, &fval->expression, params);
if (!parser_t_functions_add(parser, func)) { if (!parser_t_functions_add(parser, func)) {
ast_value_delete(var); ast_value_delete(var);