]> Cypherpunks repositories - gostls13.git/commit
go/parser: fix type switch scoping
authorRobert Griesemer <gri@golang.org>
Thu, 18 Aug 2011 17:28:58 +0000 (10:28 -0700)
committerRobert Griesemer <gri@golang.org>
Thu, 18 Aug 2011 17:28:58 +0000 (10:28 -0700)
commit18248ced3643a2cfcb4119bd5120aaa2a49b6cc8
tree30231037c5bb9c710deeb173f5210cd8fcec2ae6
parentacfb0a1584215c80e773256f25438131a57e74c3
go/parser: fix type switch scoping

The variable declared by a TypeSwitchGuard must be
visible in each TypeCaseClause and must not conflict
with other variables declared by the initial SimpleStmt
of a type switch.

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

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