]> Cypherpunks repositories - gostls13.git/commitdiff
fix export bug for /usr/r/rpc
authorRuss Cox <rsc@golang.org>
Tue, 30 Sep 2008 20:49:31 +0000 (13:49 -0700)
committerRuss Cox <rsc@golang.org>
Tue, 30 Sep 2008 20:49:31 +0000 (13:49 -0700)
R=ken
OCL=16218
CL=16218

src/cmd/gc/dcl.c
src/cmd/gc/export.c

index 71016739941d93b5767554fa3ca485b7e586fdf3..faef3bc6341ccb62fac0d36301b2df3345320434 100644 (file)
@@ -335,7 +335,7 @@ addmethod(Node *n, Type *t, int local)
        return;
 
 bad:
-       yyerror("unknown method pointer: %T", pa);
+       yyerror("unknown method pointer: %T %S %S", pa, sf, st);
 }
 
 /*
@@ -748,6 +748,7 @@ addvar(Node *n, Type *t, int ctxt)
        s->oname = n;
        s->offset = 0;
        s->vblock = block;
+       s->lexical = LNAME;
 
        n->type = t;
        n->vargen = gen;
index 94147ffe16e8b1d1380755d724c893b3232052eb..959071116951024d88064868418c049509880d54 100644 (file)
@@ -263,7 +263,7 @@ dumpe(Sym *s)
 {
        switch(s->lexical) {
        default:
-               yyerror("unknown export symbol: %S", s, s->lexical);
+               yyerror("unknown export symbol: %S", s);
                break;
        case LPACK:
                yyerror("package export symbol: %S", s);
@@ -288,6 +288,7 @@ void
 dumpm(Sym *s)
 {
        Type *t, *f;
+       Dcl *back, *d1;
 
        switch(s->lexical) {
        default:
@@ -305,17 +306,27 @@ dumpm(Sym *s)
        }
 
        for(f=t->method; f!=T; f=f->down) {
+               back = exportlist->back;
+
                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);
+       
+               if(back != exportlist->back) {
+                       // redo first pass on new entries
+                       for(d1=back; d1!=D; d1=d1->forw) {
+                               lineno = d1->lineno;
+                               dumpe(d1->dsym);
+                       }
+               }
        }
 }
 
 void
 dumpexport(void)
 {
-       Dcl *d;
+       Dcl *d, *d1;
        int32 lno;
 
        lno = lineno;
@@ -337,12 +348,6 @@ dumpexport(void)
                dumpm(d->dsym);
        }
 
-       // third pass pick up redefs from previous passes
-       for(d=exportlist->forw; d!=D; d=d->forw) {
-               lineno = d->lineno;
-               dumpe(d->dsym);
-       }
-
        Bprint(bout, "   ))\n");
 
        lineno = lno;