mirror of https://github.com/go-python/gopy.git
bind: needWrapType - preliminary support for interfaces+namedtypes
Change-Id: Ia4ef5bcf3ef36eecb02cd63e5beadc1177ef1484
This commit is contained in:
parent
47aa4f07a5
commit
93b3f8f979
|
@ -22,18 +22,28 @@ type Type interface {
|
|||
|
||||
func needWrapType(typ types.Type) bool {
|
||||
switch typ.(type) {
|
||||
case *types.Basic:
|
||||
return false
|
||||
case *types.Struct:
|
||||
return true
|
||||
case *types.Named:
|
||||
switch typ.Underlying().(type) {
|
||||
case *types.Struct:
|
||||
return true
|
||||
switch ut := typ.Underlying().(type) {
|
||||
case *types.Basic:
|
||||
return false
|
||||
default:
|
||||
return needWrapType(ut)
|
||||
}
|
||||
case *types.Array:
|
||||
return true
|
||||
case *types.Slice:
|
||||
return true
|
||||
case *types.Interface:
|
||||
wrap := true
|
||||
if typ.Underlying() == universe.syms["error"].GoType().Underlying() {
|
||||
wrap = false
|
||||
}
|
||||
return wrap
|
||||
case *types.Signature:
|
||||
return true
|
||||
}
|
||||
return false
|
||||
|
|
Loading…
Reference in New Issue