mirror of
https://github.com/golang/go
synced 2024-11-11 22:40:22 -07:00
gc: fix another blank bug
R=ken2 CC=golang-dev https://golang.org/cl/5478051
This commit is contained in:
parent
2e338fa69f
commit
8c0b699ca4
@ -515,6 +515,12 @@ nodarg(Type *t, int fp)
|
||||
n->orig = t->nname;
|
||||
|
||||
fp:
|
||||
// Rewrite argument named _ to __,
|
||||
// or else the assignment to _ will be
|
||||
// discarded during code generation.
|
||||
if(isblank(n))
|
||||
n->sym = lookup("__");
|
||||
|
||||
switch(fp) {
|
||||
default:
|
||||
fatal("nodarg %T %d", t, fp);
|
||||
|
@ -481,6 +481,7 @@ nodarg(Type *t, int fp)
|
||||
n = nod(ONAME, N, N);
|
||||
n->type = t->type;
|
||||
n->sym = t->sym;
|
||||
|
||||
if(t->width == BADWIDTH)
|
||||
fatal("nodarg: offset not computed for %T", t);
|
||||
n->xoffset = t->width;
|
||||
@ -488,6 +489,12 @@ nodarg(Type *t, int fp)
|
||||
n->orig = t->nname;
|
||||
|
||||
fp:
|
||||
// Rewrite argument named _ to __,
|
||||
// or else the assignment to _ will be
|
||||
// discarded during code generation.
|
||||
if(isblank(n))
|
||||
n->sym = lookup("__");
|
||||
|
||||
switch(fp) {
|
||||
case 0: // output arg
|
||||
n->op = OINDREG;
|
||||
|
@ -967,6 +967,12 @@ nodarg(Type *t, int fp)
|
||||
n->orig = t->nname;
|
||||
break;
|
||||
}
|
||||
|
||||
// Rewrite argument named _ to __,
|
||||
// or else the assignment to _ will be
|
||||
// discarded during code generation.
|
||||
if(isblank(n))
|
||||
n->sym = lookup("__");
|
||||
|
||||
switch(fp) {
|
||||
default:
|
||||
|
@ -118,12 +118,29 @@ func (TI) M(x int, y int) {
|
||||
}
|
||||
}
|
||||
|
||||
var fp = func(_ int, y int) {}
|
||||
|
||||
func init() {
|
||||
fp = fp1
|
||||
}
|
||||
|
||||
func fp1(x, y int) {
|
||||
if x != y {
|
||||
println("invalid fp1 call:", x, y)
|
||||
panic("bad fp1")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
func m() {
|
||||
var i I
|
||||
|
||||
i = TI{}
|
||||
i.M(1, 1)
|
||||
i.M(2, 2)
|
||||
|
||||
fp(1, 1)
|
||||
fp(2, 2)
|
||||
}
|
||||
|
||||
// useless but legal
|
||||
|
Loading…
Reference in New Issue
Block a user