2
0
mirror of synced 2025-02-22 06:28:04 +00:00

bind: fix build broken by API change to golang.org/x/tools/go/types

Fixes golang/go#11509.

Change-Id: Ia54febfa3ef9b589befb09b8f5d79cb6d7f6c4da
Reviewed-on: https://go-review.googlesource.com/11841
Reviewed-by: Robert Griesemer <gri@golang.org>
This commit is contained in:
Alan Donovan 2015-07-01 22:33:31 -04:00 committed by Alan Donovan
parent bd8fa0d7bb
commit 616f82b347

View File

@ -373,7 +373,7 @@ func (g *goGen) typeString(typ types.Type) string {
case *types.Named:
obj := t.Obj()
if obj.Pkg() == nil { // e.g. error type is *types.Named.
return types.TypeString(pkg, typ)
return types.TypeString(typ, types.RelativeTo(pkg))
}
if obj.Pkg() != g.pkg {
g.errorf("type %s not defined in package %s", t, g.pkg)
@ -381,7 +381,7 @@ func (g *goGen) typeString(typ types.Type) string {
switch t.Underlying().(type) {
case *types.Interface, *types.Struct:
return fmt.Sprintf("%s.%s", pkg.Name(), types.TypeString(pkg, typ))
return fmt.Sprintf("%s.%s", pkg.Name(), types.TypeString(typ, types.RelativeTo(pkg)))
default:
g.errorf("unsupported named type %s / %T", t, t)
}
@ -393,7 +393,7 @@ func (g *goGen) typeString(typ types.Type) string {
g.errorf("not yet supported, pointer type %s / %T", t, t)
}
default:
return types.TypeString(pkg, typ)
return types.TypeString(typ, types.RelativeTo(pkg))
}
return ""
}