Commit 00c0a3a6 authored by Robert Griesemer's avatar Robert Griesemer

go/importer: revert incorrect change that slipped in prior CL

The package of anonymous fields is the package in which they were
declared, not the package of the anonymous field's type. Was correct
before and incorrectly changed with https://golang.org/cl/18549.

Change-Id: I9fd5bfbe9d0498c8733b6ca7b134a85defe16113
Reviewed-on: https://go-review.googlesource.com/18596Reviewed-by: default avatarAlan Donovan <adonovan@google.com>
parent 4a0eee2f
......@@ -492,12 +492,10 @@ func (p *parser) parseField(parent *types.Package) (*types.Var, string) {
// anonymous field - typ must be T or *T and T must be a type name
switch typ := deref(typ).(type) {
case *types.Basic: // basic types are named types
pkg = nil
pkg = nil // objects defined in Universe scope have no package
name = typ.Name()
case *types.Named:
obj := typ.Obj()
pkg = obj.Pkg()
name = obj.Name()
name = typ.Obj().Name()
default:
p.errorf("anonymous field expected")
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment