Commit fc7b75f2 authored by Rémy Oudompheng's avatar Rémy Oudompheng

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
parent ba05a436
......@@ -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);
}
}
......
......@@ -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)
......
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