summaryrefslogtreecommitdiff
path: root/parse/node.c
diff options
context:
space:
mode:
Diffstat (limited to 'parse/node.c')
-rw-r--r--parse/node.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/parse/node.c b/parse/node.c
index 85f1763..9ff3975 100644
--- a/parse/node.c
+++ b/parse/node.c
@@ -242,9 +242,6 @@ 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);
@@ -252,6 +249,12 @@ mkimplstmt(Srcloc loc, Node *name, Type *t, Type **aux, size_t naux, Node **decl
for (i = 0; i < naux; i++)
if (hasparams(aux[i]))
bindtype(n->impl.env, aux[i]);
+ for (i = 0; i < ndecls; i++) {
+ if (name->name.ns)
+ setns(decls[i]->decl.name, name->name.ns);
+ if (decls[i]->decl.env)
+ decls[i]->decl.env->super = n->impl.env;
+ }
return n;
}
@@ -542,9 +545,8 @@ void
setns(Node *n, char *ns)
{
assert(!ns || !n->name.ns || !strcmp(n->name.ns, ns));
- if (!ns)
- return;
- n->name.ns = strdup(ns);
+ if (ns)
+ n->name.ns = strdup(ns);
}
Op