aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2016-01-13 10:41:37 -0800
committerRobert Griesemer <gri@golang.org>2016-01-13 19:10:31 +0000
commit00c0a3a677d8720123b646bb8efa3bfa1e36a8a1 (patch)
tree56b5852a005517e30bd112c6eb3b4b1a0ebb6f75
parent4a0eee2faa3c54dd267c76fe8d8c332cb6badc80 (diff)
downloadgo-00c0a3a677d8720123b646bb8efa3bfa1e36a8a1.tar.gz
go-00c0a3a677d8720123b646bb8efa3bfa1e36a8a1.zip
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/18596 Reviewed-by: Alan Donovan <adonovan@google.com>
-rw-r--r--src/go/internal/gcimporter/gcimporter.go6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/go/internal/gcimporter/gcimporter.go b/src/go/internal/gcimporter/gcimporter.go
index 2365d84931..0ef8eb4fc6 100644
--- a/src/go/internal/gcimporter/gcimporter.go
+++ b/src/go/internal/gcimporter/gcimporter.go
@@ -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")
}