gopy/bind/types.go

41 lines
688 B
Go
Raw Normal View History

2015-07-24 14:16:31 +00:00
// Copyright 2015 The go-python Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package bind
import (
"golang.org/x/tools/go/types"
)
2015-07-28 12:33:47 +00:00
type Object interface {
Package() *Package
ID() string
Doc() string
2015-07-28 12:33:47 +00:00
GoName() string
}
2015-07-28 12:33:47 +00:00
type Type interface {
Object
GoType() types.Type
}
2015-07-24 14:16:31 +00:00
func needWrapType(typ types.Type) bool {
switch typ.(type) {
case *types.Struct:
return true
case *types.Named:
switch typ.Underlying().(type) {
case *types.Struct:
return true
}
2015-07-31 16:01:49 +00:00
case *types.Array:
return true
case *types.Slice:
return true
case *types.Interface:
return true
2015-07-24 14:16:31 +00:00
}
return false
}