shithub: mc

Download patch

ref: 6fd59842dc48fd8a4dafe580c79cae37c01ab675
parent: dffeabb9ccfbe8dc25bebb78f7471578d6cac9c4
author: Ori Bernstein <[email protected]>
date: Wed Jan 8 08:36:45 EST 2014

Check namespaces in inferexpr, instead of infersub

    We were missing some cases where we forgot to check
    namespaces properly.

--- a/parse/infer.c
+++ b/parse/infer.c
@@ -1032,8 +1032,6 @@
         if (args[i]->type == Nexpr) {
             /* Omemb can sometimes resolve to a namespace. We have to check
              * this. Icky. */
-            if (exprop(args[i]) == Omemb)
-                checkns(st, args[i], &args[i]);
             inferexpr(st, args[i], ret, sawret);
             isconst = isconst && args[i]->expr.isconst;
         }
@@ -1055,6 +1053,9 @@
     args = n->expr.args;
     nargs = n->expr.nargs;
     infernode(st, n->expr.idx, NULL, NULL);
+    for (i = 0; i < nargs; i++)
+        if (args[i]->type == Nexpr && exprop(args[i]) == Omemb)
+            checkns(st, args[i], &args[i]);
     switch (exprop(n)) {
         /* all operands are same type */
         case Oadd:      /* @a + @a -> @a */