1
0
mirror of https://github.com/golang/go synced 2024-11-18 15:54:42 -07:00

cmd/gc: fix export data for aggressive inlining.

Export data was broken after revision 6b602ab487d6
when -l is specified at least 3 times: it makes the compiler
write out func (*T).Method() declarations in export data, which
is not supported.

Also fix the formatting of recover() in export data. It was
not treated like panic() and was rendered as "<node RECOVER>".

R=golang-dev, lvd, minux.ma, rsc
CC=golang-dev
https://golang.org/cl/7067051
This commit is contained in:
Rémy Oudompheng 2013-01-30 21:10:19 +01:00
parent ba05a43608
commit fc7b75f216
2 changed files with 12 additions and 1 deletions

View File

@ -106,12 +106,19 @@ reexportdep(Node *n)
switch(n->class&~PHEAP) {
case PFUNC:
// methods will be printed along with their type
// nodes for T.Method expressions
if(n->left && n->left->op == OTYPE)
break;
// nodes for method calls.
if(!n->type || n->type->thistuple > 0)
break;
// fallthrough
case PEXTERN:
if(n->sym && !exportedsym(n->sym))
if(n->sym && !exportedsym(n->sym)) {
if(debug['E'])
print("reexport name %S\n", n->sym);
exportlist = list(exportlist, n);
}
}
break;
@ -122,6 +129,8 @@ reexportdep(Node *n)
if(isptr[t->etype])
t = t->type;
if(t && t->sym && t->sym->def && !exportedsym(t->sym)) {
if(debug['E'])
print("reexport type %S from declaration\n", t->sym);
exportlist = list(exportlist, t->sym->def);
}
}

View File

@ -228,6 +228,7 @@ goopnames[] =
[ORANGE] = "range",
[OREAL] = "real",
[ORECV] = "<-",
[ORECOVER] = "recover",
[ORETURN] = "return",
[ORSH] = ">>",
[OSELECT] = "select",
@ -1290,6 +1291,7 @@ exprfmt(Fmt *f, Node *n, int prec)
case OMAKE:
case ONEW:
case OPANIC:
case ORECOVER:
case OPRINT:
case OPRINTN:
if(n->left)