]> git.xonotic.org Git - xonotic/gmqcc.git/blobdiff - parser.cpp
Revert "search for funciton param first before function locals, this fixes #163"
[xonotic/gmqcc.git] / parser.cpp
index 7e552325d544caf5ebb5a955bbf933d80f8f0926..1404273735d83f2e1f2c583e5d4905b3231008d3 100644 (file)
@@ -135,22 +135,17 @@ 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;
     }
-    return NULL;
+    *isparam = true;
+    return parser_find_param(parser, name);
 }
 
 static ast_expression* parser_find_local(parser_t *parser, const std::string &name, size_t upto, bool *isparam) {
@@ -347,7 +342,7 @@ static bool parser_sy_apply_operator(parser_t *parser, shunt *sy)
     const oper_info *op;
     lex_ctx_t ctx;
     ast_expression *out = nullptr;
-    ast_expression *exprs[3];
+    ast_expression *exprs[3] = { 0, 0, 0 };
     ast_block      *blocks[3];
     ast_binstore   *asbinstore;
     size_t i, assignop, addop, subop;