go.tools/ssa: use correct names for Captures.

Until now, the name of the captured ssa.Value, not
types.Var was used, leading to confusing disassembly
when it was a numbered register.  See:
https://code.google.com/p/go/issues/detail?id=6337

Now the output is:

# Free variables:
#   0:	a *int
#   1:	b *int
func func@6.9() int:
.0.entry:
        t0 = *b
        t1 = *a
        t2 = *b
        etc...

BUG=6337

R=crawshaw
CC=golang-dev
https://golang.org/cl/13249049
This commit is contained in:
Alan Donovan 2013-09-06 09:19:34 -04:00
parent a1dade8bdc
commit 33f988691e
1 changed files with 1 additions and 1 deletions

View File

@ -430,7 +430,7 @@ func (f *Function) lookup(obj types.Object, escaping bool) Value {
}
outer := f.Enclosing.lookup(obj, true) // escaping
v := &Capture{
name: outer.Name(),
name: obj.Name(),
typ: outer.Type(),
pos: outer.Pos(),
outer: outer,