2
0
mirror of synced 2025-02-23 06:48:15 +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: case *types.Named:
obj := t.Obj() obj := t.Obj()
if obj.Pkg() == nil { // e.g. error type is *types.Named. 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 { if obj.Pkg() != g.pkg {
g.errorf("type %s not defined in package %s", t, 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) { switch t.Underlying().(type) {
case *types.Interface, *types.Struct: 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: default:
g.errorf("unsupported named type %s / %T", t, t) 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) g.errorf("not yet supported, pointer type %s / %T", t, t)
} }
default: default:
return types.TypeString(pkg, typ) return types.TypeString(typ, types.RelativeTo(pkg))
} }
return "" return ""
} }