From b70fd7e238b1ac532e53675178a11e63312cd9d9 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Fri, 27 Jul 2012 12:25:46 +0200 Subject: [PATCH] handle parameters in parser_find_local --- parser.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/parser.c b/parser.c index 4ffb61c..81dda62 100644 --- a/parser.c +++ b/parser.c @@ -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; }