1
0
mirror of https://github.com/golang/go synced 2024-11-18 09:04:49 -07:00

go/parser: selectors may be method expressions

R=adonovan
CC=golang-dev
https://golang.org/cl/12062043
This commit is contained in:
Robert Griesemer 2013-07-29 13:52:15 -07:00
parent 46437f0028
commit 340918a8a3
2 changed files with 2 additions and 1 deletions

View File

@ -1408,7 +1408,7 @@ L:
}
switch p.tok {
case token.IDENT:
x = p.parseSelector(p.checkExpr(x))
x = p.parseSelector(p.checkExprOrType(x))
case token.LPAREN:
x = p.parseTypeAssertion(p.checkExpr(x))
default:

View File

@ -34,6 +34,7 @@ var valids = []string{
`package p; func f() { switch ; {} };`,
`package p; func f() { for _ = range "foo" + "bar" {} };`,
`package p; func f() { var s []int; g(s[:], s[i:], s[:j], s[i:j], s[i:j:k], s[:j:k]) };`,
`package p; var ( _ = (struct {*T}).m; _ = (interface {T}).m )`,
}
func TestValid(t *testing.T) {