mirror of https://github.com/golang/go.git
go/callgraph/vta: use types.IsInterface instead of our own isInterface
Change-Id: I9e5a81e4f59f32e3bfc6baf2348ee3e4db411aae Reviewed-on: https://go-review.googlesource.com/c/tools/+/417674 gopls-CI: kokoro <noreply+kokoro@google.com> Reviewed-by: Tim King <taking@google.com> Run-TryBot: Zvonimir Pavlinovic <zpavlinovic@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
parent
2eaea86599
commit
2957e9da5d
|
|
@ -654,7 +654,7 @@ func (b *builder) addInFlowEdge(s, d node) {
|
|||
|
||||
// Creates const, pointer, global, func, and local nodes based on register instructions.
|
||||
func (b *builder) nodeFromVal(val ssa.Value) node {
|
||||
if p, ok := val.Type().(*types.Pointer); ok && !isInterface(p.Elem()) && !isFunction(p.Elem()) {
|
||||
if p, ok := val.Type().(*types.Pointer); ok && !types.IsInterface(p.Elem()) && !isFunction(p.Elem()) {
|
||||
// Nested pointer to interfaces are modeled as a special
|
||||
// nestedPtrInterface node.
|
||||
if i := interfaceUnderPtr(p.Elem()); i != nil {
|
||||
|
|
|
|||
|
|
@ -183,7 +183,7 @@ func hasInitialTypes(n node) bool {
|
|||
case panicArg, recoverReturn, nestedPtrFunction, nestedPtrInterface:
|
||||
return false
|
||||
default:
|
||||
return !isInterface(n.Type())
|
||||
return !types.IsInterface(n.Type())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ func newLocal(name string, t types.Type) local {
|
|||
|
||||
// newNamedType creates a bogus type named `name`.
|
||||
func newNamedType(name string) *types.Named {
|
||||
return types.NewNamed(types.NewTypeName(token.NoPos, nil, name, nil), nil, nil)
|
||||
return types.NewNamed(types.NewTypeName(token.NoPos, nil, name, nil), types.Universe.Lookup("int").Type(), nil)
|
||||
}
|
||||
|
||||
// sccString is a utility for stringifying `nodeToScc`. Every
|
||||
|
|
|
|||
|
|
@ -56,12 +56,7 @@ func hasInFlow(n node) bool {
|
|||
return true
|
||||
}
|
||||
|
||||
return isInterface(t) || isFunction(t)
|
||||
}
|
||||
|
||||
func isInterface(t types.Type) bool {
|
||||
_, ok := t.Underlying().(*types.Interface)
|
||||
return ok
|
||||
return types.IsInterface(t) || isFunction(t)
|
||||
}
|
||||
|
||||
func isFunction(t types.Type) bool {
|
||||
|
|
@ -86,7 +81,7 @@ func interfaceUnderPtr(t types.Type) types.Type {
|
|||
return nil
|
||||
}
|
||||
|
||||
if isInterface(p.Elem()) {
|
||||
if types.IsInterface(p.Elem()) {
|
||||
return p.Elem()
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue