handle parameters in parser_find_local

This commit is contained in:
Wolfgang Bumiller 2012-07-27 12:25:46 +02:00
parent a99972d7dd
commit b70fd7e238

View file

@ -90,11 +90,17 @@ ast_value* parser_find_global(parser_t *parser, const char *name)
ast_value* parser_find_local(parser_t *parser, const char *name, size_t upto)
{
size_t i;
ast_value *fun;
for (i = parser->locals_count; i > upto;) {
--i;
if (!strcmp(parser->locals[i]->name, name))
return parser->locals[i];
}
fun = parser->function->vtype;
for (i = 0; i < fun->params_count; ++i) {
if (!strcmp(fun->params[i]->name, name))
return fun->params[i];
}
return NULL;
}