]> Cypherpunks repositories - gostls13.git/commit
go/parser: fix type switch scoping
authorRobert Griesemer <gri@golang.org>
Tue, 23 Aug 2011 16:22:41 +0000 (09:22 -0700)
committerRobert Griesemer <gri@golang.org>
Tue, 23 Aug 2011 16:22:41 +0000 (09:22 -0700)
commitf6d536bea4efac42c5baee5188293ad7be2f70c3
tree26a218870ab5aa6822d1c1b70bb720aecfe48bdf
parentf0ef4f474620ed95a7572c579689f262e79a724f
go/parser: fix type switch scoping

Introduce extra scope for the variable declared by a
TypeSwitchGuard so that it doesn't conflict with vars
declared by the initial SimpleStmt of a type switch.

This is a replacement for CL 4896053 which caused
a build breakage.

Also:
- explicitly detect type switches (as opposed to detecting
  expression switches and then do extra testing for type switches)
- fix all outstanding TODOs in parser.go
- ran all tests

R=rsc
CC=golang-dev
https://golang.org/cl/4914044
src/cmd/gotype/testdata/test1.go
src/pkg/go/parser/parser.go
src/pkg/go/parser/parser_test.go