Commit 07687705 authored by Russ Cox's avatar Russ Cox

type n t;

was copying a bit too much about t into n,
like whether the signature was queued to be printed.
(bug reported by anton)

was also editing t, meaning you could do
	type T int;
	func (p int) Meth() { }

both fixed.

R=ken
OCL=27052
CL=27052
parent 416b2754
......@@ -91,6 +91,7 @@ void
updatetype(Type *n, Type *t)
{
Sym *s;
int local;
s = n->sym;
if(s == S || s->otype != n)
......@@ -118,10 +119,19 @@ updatetype(Type *n, Type *t)
fatal("updatetype %T / %T", n, t);
}
if(n->local)
t->local = 1;
// decl was
// type n t;
// copy t, but then zero out state associated with t
// that is no longer associated with n.
local = n->local;
*n = *t;
n->sym = s;
n->local = local;
n->siggen = 0;
n->methptr = 0;
n->printed = 0;
n->method = nil;
n->vargen = 0;
// catch declaration of incomplete type
switch(n->etype) {
......
......@@ -425,6 +425,7 @@ dumpsignatures(void)
t = d->dtype;
et = t->etype;
s = signame(t);
//print("signame %S for %T\n", s, t);
if(s == S)
continue;
......
......@@ -1637,8 +1637,8 @@ signame(Type *t)
ss->oname->class = PEXTERN;
}
//print("siggen %T %d\n", t, t->siggen);
if(!t->siggen) {
//print("siggen %T\n", t);
// special case: don't generate the empty interface
if(strcmp(buf, "empty") == 0)
goto out;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment