FAQ
Reviewers: ken2,

Message:
Hello ken2 (cc: golang-dev@googlegroups.com),

I'd like you to review this change to
https://code.google.com/p/go/


Description:
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 issue 4326.

Please review this at http://codereview.appspot.com/6816100/

Affected files:
M src/cmd/gc/dcl.c
M src/cmd/gc/esc.c
M src/cmd/gc/fmt.c
M src/pkg/exp/types/gcimporter_test.go
A test/fixedbugs/issue4326.dir/p1.go
A test/fixedbugs/issue4326.dir/p2.go
A test/fixedbugs/issue4326.dir/q1.go
A test/fixedbugs/issue4326.dir/q2.go
A test/fixedbugs/issue4326.dir/z.go
A test/fixedbugs/issue4326.go

Search Discussions

  • Rsc at Nov 7, 2012 at 2:59 pm
    *** Submitted as
    http://code.google.com/p/go/source/detail?r=25dcee3d220c ***

    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 issue 4326.

    R=ken2
    CC=golang-dev
    http://codereview.appspot.com/6816100


    http://codereview.appspot.com/6816100/
  • Ken at Nov 7, 2012 at 8:41 pm

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-dev @
categoriesgo
postedNov 7, '12 at 2:59p
activeNov 7, '12 at 8:41p
posts3
users2
websitegolang.org

2 users in discussion

Rsc: 2 posts Ken: 1 post

People

Translate

site design / logo © 2022 Grokbase