]> Cypherpunks repositories - gostls13.git/commit
cmd/gc: annotate local variables with unique ids for inlining
authorRuss Cox <rsc@golang.org>
Wed, 7 Nov 2012 14:59:19 +0000 (09:59 -0500)
committerRuss Cox <rsc@golang.org>
Wed, 7 Nov 2012 14:59:19 +0000 (09:59 -0500)
commitcb856adea965955c4d2424b2946b0db90a682b78
tree23674295ab349546a226093788cb7c36bc773462
parentc6f363b22abe905abb5f2c17f4b1356c6c74aef9
cmd/gc: annotate local variables with unique ids for inlining

Avoids problems with local declarations shadowing other names.
We write a more explicit form than the incoming program, so there
may be additional type annotations. For example:

        int := "hello"
        j := 2

would normally turn into

        var int string = "hello"
        var j int = 2

but the int variable shadows the int type in the second line.

This CL marks all local variables with a per-function sequence number,
so that this would instead be:

        var int·1 string = "hello"
        var j·2 int = 2

Fixes #4326.

R=ken2
CC=golang-dev
https://golang.org/cl/6816100
src/cmd/gc/dcl.c
src/cmd/gc/esc.c
src/cmd/gc/fmt.c
src/pkg/exp/types/gcimporter_test.go
test/fixedbugs/issue4326.dir/p1.go [new file with mode: 0644]
test/fixedbugs/issue4326.dir/p2.go [new file with mode: 0644]
test/fixedbugs/issue4326.dir/q1.go [new file with mode: 0644]
test/fixedbugs/issue4326.dir/q2.go [new file with mode: 0644]
test/fixedbugs/issue4326.dir/z.go [new file with mode: 0644]
test/fixedbugs/issue4326.go [new file with mode: 0644]