go.tools/go/types: imported structs may contain _ fields

Don't report import errors due to (multiple) _ fields
in imported structs.

Fixes golang/go#5758.

R=adonovan
CC=golang-dev
https://golang.org/cl/10529043
This commit is contained in:
Robert Griesemer 2013-06-24 17:38:41 -07:00
parent 6740bb0838
commit 124e603d87
1 changed files with 4 additions and 1 deletions

View File

@ -506,7 +506,10 @@ func (p *gcParser) parseStructType() Type {
if tags != nil { if tags != nil {
tags = append(tags, tag) tags = append(tags, tag)
} }
if alt := scope.Insert(fld); alt != nil { if fld.name == "_" {
// blank identifiers are not declared
fld.setParent(scope)
} else if alt := scope.Insert(fld); alt != nil {
pname := "<no pkg name>" pname := "<no pkg name>"
if pkg := alt.Pkg(); pkg != nil { if pkg := alt.Pkg(); pkg != nil {
pname = pkg.name pname = pkg.name