mirror of
https://github.com/golang/go
synced 2024-11-12 02:00:23 -07:00
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
This commit is contained in:
parent
416b27548e
commit
07687705a4
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user