1
0
mirror of https://github.com/golang/go synced 2024-11-18 23:54:41 -07:00

go.tools/go/types: fix build (gc export format changed)

Revision f280b8a485fd of the std library changed the
gc export format: anonymous fields may be qualified
with a package.

R=rsc
TBR=rsc
CC=golang-dev
https://golang.org/cl/14312043
This commit is contained in:
Robert Griesemer 2013-10-02 16:53:34 -07:00
parent 63365376db
commit b9b3bed16e

View File

@ -349,13 +349,18 @@ func (p *gcParser) parseDotIdent() string {
return ident
}
// QualifiedName = "@" PackageId "." dotIdentifier .
// QualifiedName = "@" PackageId "." ( "?" | dotIdentifier ) .
//
func (p *gcParser) parseQualifiedName() (id, name string) {
p.expect('@')
id = p.parsePackageId()
p.expect('.')
name = p.parseDotIdent()
// Per rev f280b8a485fd (10/2/2013), qualified names may be used for anoymous fields.
if p.tok == '?' {
p.next()
} else {
name = p.parseDotIdent()
}
return
}
@ -479,7 +484,7 @@ func (p *gcParser) parseField() (*Var, string) {
pkg = nil
name = typ.name
case *Named:
pkg = typ.obj.pkg
pkg = typ.obj.pkg // TODO(gri) is this still correct?
name = typ.obj.name
default:
p.errorf("anonymous field expected")