ref: 1ed355447b8aa5aa8861651d5a657691fe939218
parent: 3d7695c257de8ea4d4c0b8999682de0b29ee3c20
author: Ori Bernstein <ori@eigenstate.org>
date: Fri Jun 17 19:05:06 EDT 2016
Allow implementing traits from other namespaces.
--- a/6/main.c
+++ b/6/main.c
@@ -122,7 +122,7 @@
{
Node *n, *name;
- name = mknsname(Zloc, "", "main");
+ name = mknsname(Zloc, NULL, "main");
n = getdcl(file->file.globls, name);
if (!n)
return 0;
--- a/parse/node.c
+++ b/parse/node.c
@@ -328,7 +328,8 @@
Node *n;
n = mknode(loc, Nname);
- n->name.ns = strdup(ns);
+ if (ns)
+ n->name.ns = strdup(ns);
n->name.name = strdup(name);
return n;
--- a/parse/stab.c
+++ b/parse/stab.c
@@ -167,6 +167,8 @@
Stab *fn;
fn = NULL;
+ if (n->name.ns)
+ st = getns(file, n->name.ns);
do {
s = htget(st->dcl, n);
if (s) {
@@ -246,6 +248,8 @@
{
Traitdefn *c;
+ if (n->name.ns)
+ st = getns(file, n->name.ns);
do {
if ((c = htget(st->tr, n)))
return c->trait;