From: Dale Weiler Date: Fri, 1 Dec 2017 17:24:50 +0000 (-0500) Subject: search for funciton param first before function locals, this fixes #163 X-Git-Tag: xonotic-v0.8.5~28 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=3cf2c52fce792af3e5cc5578b336de83217e625d;p=xonotic%2Fgmqcc.git search for funciton param first before function locals, this fixes #163 --- 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) {