]> git.xonotic.org Git - xonotic/gmqcc.git/commitdiff
search for funciton param first before function locals, this fixes #163
authorDale Weiler <weilercdale@gmail.com>
Fri, 1 Dec 2017 17:24:50 +0000 (12:24 -0500)
committerDale Weiler <weilercdale@gmail.com>
Fri, 1 Dec 2017 17:24:50 +0000 (12:24 -0500)
parser.cpp

index 4f7ea699c5039537dcb9390c7180ca1127554986..7e552325d544caf5ebb5a955bbf933d80f8f0926 100644 (file)
@@ -135,17 +135,22 @@ static ast_expression* parser_find_local(parser_t *parser, const char *name, siz
 {
     size_t          i, hash;
     ast_expression *e;
 {
     size_t          i, hash;
     ast_expression *e;
+    ast_expression *p;
 
     hash = util_hthash(parser->htglobals, name);
 
     *isparam = false;
 
     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;
     }
     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) {
 }
 
 static ast_expression* parser_find_local(parser_t *parser, const std::string &name, size_t upto, bool *isparam) {