1
0
mirror of https://github.com/golang/go synced 2024-11-22 04:44:39 -07:00

gc: inlining, allow empty bodies, fix _ arguments.

R=rsc
CC=golang-dev
https://golang.org/cl/5487077
This commit is contained in:
Luuk van Dijk 2011-12-15 17:50:59 +01:00
parent 5b2f8d96ce
commit 7e6890a670
3 changed files with 9 additions and 4 deletions

View File

@ -914,6 +914,9 @@ stmtfmt(Fmt *f, Node *n)
fmtprint(f, "%#O", n->op); fmtprint(f, "%#O", n->op);
break; break;
case OEMPTY:
break;
case OLABEL: case OLABEL:
fmtprint(f, "%N: ", n->left); fmtprint(f, "%N: ", n->left);
break; break;
@ -1018,6 +1021,7 @@ static int opprec[] = {
[ODCL] = -1, [ODCL] = -1,
[ODCLFIELD] = -1, [ODCLFIELD] = -1,
[ODEFER] = -1, [ODEFER] = -1,
[OEMPTY] = -1,
[OFALL] = -1, [OFALL] = -1,
[OFOR] = -1, [OFOR] = -1,
[OIF] = -1, [OIF] = -1,

View File

@ -60,7 +60,7 @@ caninl(Node *fn)
case ORETURN: case ORETURN:
case OAS: case OAS:
case OAS2: case OAS2:
// case OEMPTY: // TODO case OEMPTY:
break; break;
} }
@ -449,7 +449,7 @@ mkinlcall(Node **np, Node *fn)
// TODO check that n->list->n is a call? // TODO check that n->list->n is a call?
as->rlist = n->list; as->rlist = n->list;
for(t = getinargx(fn->type)->type; t; t=t->down) { for(t = getinargx(fn->type)->type; t; t=t->down) {
if(t->nname) { if(t->nname && !isblank(t->nname)) {
if(!t->nname->inlvar) if(!t->nname->inlvar)
fatal("missing inlvar for %N\n", t->nname); fatal("missing inlvar for %N\n", t->nname);
as->list = list(as->list, t->nname->inlvar); as->list = list(as->list, t->nname->inlvar);
@ -460,7 +460,7 @@ mkinlcall(Node **np, Node *fn)
} else { } else {
ll = n->list; ll = n->list;
for(t = getinargx(fn->type)->type; t && ll; t=t->down) { for(t = getinargx(fn->type)->type; t && ll; t=t->down) {
if(t->nname) { if(t->nname && !isblank(t->nname)) {
if(!t->nname->inlvar) if(!t->nname->inlvar)
fatal("missing inlvar for %N\n", t->nname); fatal("missing inlvar for %N\n", t->nname);
as->list = list(as->list, t->nname->inlvar); as->list = list(as->list, t->nname->inlvar);

View File

@ -8,7 +8,8 @@ package main
import "unsafe" import "unsafe"
func use(bool) {} var global bool
func use(b bool) { global = b }
func stringptr(s string) uintptr { return *(*uintptr)(unsafe.Pointer(&s)) } func stringptr(s string) uintptr { return *(*uintptr)(unsafe.Pointer(&s)) }