From 3cf2c52fce792af3e5cc5578b336de83217e625d Mon Sep 17 00:00:00 2001 From: Dale Weiler Date: Fri, 1 Dec 2017 12:24:50 -0500 Subject: [PATCH] search for funciton param first before function locals, this fixes #163 --- parser.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/parser.cpp b/parser.cpp index 4f7ea69..7e55232 100644 --- a/parser.cpp +++ b/parser.cpp @@ -135,17 +135,22 @@ static ast_expression* parser_find_local(parser_t *parser, const char *name, siz { size_t i, hash; ast_expression *e; + ast_expression *p; hash = util_hthash(parser->htglobals, name); *isparam = false; + p = parser_find_param(parser, name); + if (p) { + *isparam = true; + return p; + } for (i = parser->variables.size(); i > upto;) { --i; if ( (e = (ast_expression*)util_htgeth(parser->variables[i], name, hash)) ) return e; } - *isparam = true; - return parser_find_param(parser, name); + return NULL; } static ast_expression* parser_find_local(parser_t *parser, const std::string &name, size_t upto, bool *isparam) { -- 2.39.2