shithub: mc

Download patch

ref: d1db37f1bd7260d91a03a57cb136bc1c41f54909
parent: 27ee8d46c38cf5d1960695efc97a36d00dfb1ccb
author: Ori Bernstein <[email protected]>
date: Fri Feb 21 08:21:27 EST 2014

Allow exported names to work with namespaces.

--- a/parse/infer.c
+++ b/parse/infer.c
@@ -1337,7 +1337,8 @@
         /* look up the prototype */
         proto = NULL;
         dcl = n->impl.decls[i];
-        for (j = 0; j < t->nfuncs; i++) {
+        setns(dcl->decl.name, namestr(file->file.globls->name));
+        for (j = 0; j < t->nfuncs; j++) {
             if (nameeq(dcl->decl.name, t->funcs[j]->decl.name)) {
                 proto = t->funcs[j];
                 break;
@@ -1345,7 +1346,7 @@
         }
         if (!dcl || !proto)
             fatal(n->line, "Declaration %s missing in %s, near %s\n",
-                  namestr(dcl), namestr(t->name), ctxstr(st, n));
+                  namestr(dcl->decl.name), namestr(t->name), ctxstr(st, n));
 
         /* infer and unify types */
         checktraits(t->param, n->impl.type);