1
0
mirror of https://github.com/golang/go synced 2024-11-26 13:08:08 -07:00

fixed export sort for methods

R=r
OCL=15699
CL=15699
This commit is contained in:
Ken Thompson 2008-09-23 12:48:52 -07:00
parent b390608636
commit dc04d096f0

View File

@ -236,13 +236,6 @@ dumpexporttype(Sym *s)
Bprint(bout, "%lS %d %lS\n", s, t->chan, t->type->sym);
break;
}
for(f=t->method; f!=T; f=f->down) {
if(f->etype != TFIELD)
fatal("dumpexporttype: method not field: %lT", f);
reexport(f->type);
Bprint(bout, "\tfunc %S %lS\n", f->sym, f->type->sym);
}
}
void
@ -268,6 +261,34 @@ dumpe(Sym *s)
}
}
void
dumpm(Sym *s)
{
Type *t, *f;
switch(s->lexical) {
default:
return;
case LATYPE:
case LBASETYPE:
break;
}
t = s->otype;
if(t == T) {
yyerror("type exported but not defined: %S", s);
return;
}
for(f=t->method; f!=T; f=f->down) {
if(f->etype != TFIELD)
fatal("dumpexporttype: method not field: %lT", f);
reexport(f->type);
Bprint(bout, "\tfunc %S %lS\n", f->sym, f->type->sym);
}
}
void
dumpexport(void)
{
@ -281,12 +302,18 @@ dumpexport(void)
Bprint(bout, " package %s\n", package);
// print it depth first
// first pass dump vars/types depth first
for(d=exportlist->forw; d!=D; d=d->forw) {
lineno = d->lineno;
dumpe(d->dsym);
}
// second pass dump methods
for(d=exportlist->forw; d!=D; d=d->forw) {
lineno = d->lineno;
dumpm(d->dsym);
}
Bprint(bout, " ))\n");
lineno = lno;