summaryrefslogtreecommitdiff
path: root/parse/node.c
diff options
context:
space:
mode:
Diffstat (limited to 'parse/node.c')
-rw-r--r--parse/node.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/parse/node.c b/parse/node.c
index 4a8df7d..d32d4ab 100644
--- a/parse/node.c
+++ b/parse/node.c
@@ -247,6 +247,7 @@ Node *
mkimplstmt(Srcloc loc, Node *name, Type *t, Type **aux, size_t naux, Node **decls, size_t ndecls)
{
Node *n;
+ size_t i;
n = mknode(loc, Nimpl);
n->impl.traitname = name;
@@ -256,6 +257,9 @@ mkimplstmt(Srcloc loc, Node *name, Type *t, Type **aux, size_t naux, Node **decl
n->impl.decls = decls;
n->impl.ndecls = ndecls;
lappend(&impltab, &nimpltab, n);
+ if (name->name.ns)
+ for (i = 0; i < ndecls; i++)
+ setns(decls[i]->decl.name, name->name.ns);
if (hasparams(t)) {
n->impl.env = mkenv();
bindtype(n->impl.env, t);
@@ -550,7 +554,6 @@ void
setns(Node *n, char *ns)
{
assert(!ns || !n->name.ns || !strcmp(n->name.ns, ns));
-
if (!ns)
return;
n->name.ns = strdup(ns);