Documentation
¶
Index ¶
- func IsError(t gotypes.Type) bool
- type RootTypeInfo
- type TypeDB
- func (t *TypeDB) AddType(actualType gotypes.Type, dependentType gotypes.Type) *TypeInfo
- func (t *TypeDB) LocateTypeInfo(locateType gotypes.Type) *TypeInfo
- func (t *TypeDB) ResolveDependencies()
- func (t *TypeDB) WalkAllTypes(visitor func(t *TypeInfo) error) error
- func (t *TypeDB) WalkRootTypes(visitor func(t *RootTypeInfo) error) error
- type TypeIdentifier
- type TypeInfo
- type TypeMode
- type TypeWalker
- type WrapStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type RootTypeInfo ¶
type RootTypeInfo struct {
RootType TypeIdentifier // This is the base, unpointered struct or whatever
ClaimedMethods map[string]string // This is the list of method names that have already been used (and shouldn't be re-wrapped)
// The value is the type key for the owning type- this is necessary because
// we may assign a method to one type initially but allow another method to steal
// it later
HasDirectReceiver bool // If true, there is a method with a direct non-pointer receiver
}
func (*RootTypeInfo) CanUseMethod ¶
func (r *RootTypeInfo) CanUseMethod(t gotypes.Type, method string) bool
type TypeDB ¶
type TypeDB struct {
// contains filtered or unexported fields
}
func (*TypeDB) ResolveDependencies ¶
func (t *TypeDB) ResolveDependencies()
ResolveDependencies flows type statuses up the dependency graph, so if a "WrapStatusDont" type depends on a "WrapStatusHard" type, it becomes a "WrapStatusHard" type The only exception is that non-interfaces that depend on a WrapStatusSoft type become a WrapStatusHard type, since only interfaces can be soft. Soft indicates that the wrapped interface will be reused with a wrapping implementation. Hard indicates a brand new type is necessary.
func (*TypeDB) WalkRootTypes ¶
func (t *TypeDB) WalkRootTypes(visitor func(t *RootTypeInfo) error) error
type TypeIdentifier ¶
type TypeIdentifier struct {
TypeKey string
Mode TypeMode
PointerDepth int // Only used for structs- how many *'s on this type?
Type gotypes.Type
}
func (*TypeIdentifier) String ¶
func (t *TypeIdentifier) String() string
func (TypeIdentifier) TypeFileName ¶
func (t TypeIdentifier) TypeFileName() string
func (TypeIdentifier) WrapFuncName ¶
func (t TypeIdentifier) WrapFuncName() string
func (TypeIdentifier) WrapperTypeName ¶
func (t TypeIdentifier) WrapperTypeName() string
type TypeInfo ¶
type TypeInfo struct {
TypeId TypeIdentifier // This is information for THIS type
RootType *RootTypeInfo
Status WrapStatus
MethodToWrap []*gotypes.Selection
}
type TypeWalker ¶
type TypeWalker struct {
// contains filtered or unexported fields
}
func NewTypeWalker ¶
func NewTypeWalker(packages []string) *TypeWalker
func (*TypeWalker) QueueType ¶
func (s *TypeWalker) QueueType(queueType gotypes.Type, dependentType gotypes.Type)
func (*TypeWalker) WalkTypes ¶
func (state *TypeWalker) WalkTypes() *TypeDB
type WrapStatus ¶
type WrapStatus int
const ( WrapStatusDont WrapStatus = WrapStatus(iota) // Do not wrap this type WrapStatusSoft // This type is an interface- a new implementation should be written that wraps the interface WrapStatusHard // An entirely new type needs to be written that wraps the old type )
Click to show internal directories.
Click to hide internal directories.