mirror of
https://github.com/golang/go
synced 2024-11-24 01:20:08 -07:00
go/internal/gcimporter: backport changes from x/tools/go/gcimporter15
See https://go-review.googlesource.com/32581. This makes x/tools/go/gcimporter15/bimport.go a close copy again and the importer more robust. Change-Id: If96ad6acd611878b7dfa6a13d005d847ece82ab6 Reviewed-on: https://go-review.googlesource.com/32647 TryBot-Result: Gobot Gobot <gobot@golang.org> Run-TryBot: Robert Griesemer <gri@golang.org> Reviewed-by: Alan Donovan <adonovan@google.com>
This commit is contained in:
parent
322436b78c
commit
18f0e88103
@ -278,11 +278,13 @@ func (p *importer) obj(tag int) {
|
|||||||
p.declare(types.NewFunc(pos, pkg, name, sig))
|
p.declare(types.NewFunc(pos, pkg, name, sig))
|
||||||
|
|
||||||
case aliasTag:
|
case aliasTag:
|
||||||
aliasPos := p.pos()
|
pos := p.pos()
|
||||||
aliasName := p.string()
|
name := p.string()
|
||||||
pkg, name := p.qualifiedName()
|
var orig types.Object
|
||||||
obj := pkg.Scope().Lookup(name)
|
if pkg, name := p.qualifiedName(); pkg != nil {
|
||||||
p.declare(types.NewAlias(aliasPos, p.pkgList[0], aliasName, obj))
|
orig = pkg.Scope().Lookup(name)
|
||||||
|
}
|
||||||
|
p.declare(types.NewAlias(pos, p.pkgList[0], name, orig))
|
||||||
|
|
||||||
default:
|
default:
|
||||||
errorf("unexpected object tag %d", tag)
|
errorf("unexpected object tag %d", tag)
|
||||||
@ -343,7 +345,9 @@ var (
|
|||||||
|
|
||||||
func (p *importer) qualifiedName() (pkg *types.Package, name string) {
|
func (p *importer) qualifiedName() (pkg *types.Package, name string) {
|
||||||
name = p.string()
|
name = p.string()
|
||||||
|
if name != "" {
|
||||||
pkg = p.pkg()
|
pkg = p.pkg()
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user