1
0
mirror of https://github.com/golang/go synced 2024-11-21 23:04: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);
break;
case OEMPTY:
break;
case OLABEL:
fmtprint(f, "%N: ", n->left);
break;
@ -1018,6 +1021,7 @@ static int opprec[] = {
[ODCL] = -1,
[ODCLFIELD] = -1,
[ODEFER] = -1,
[OEMPTY] = -1,
[OFALL] = -1,
[OFOR] = -1,
[OIF] = -1,

View File

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

View File

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