types

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 21, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsError

func IsError(t gotypes.Type) bool

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) AddType

func (t *TypeDB) AddType(actualType gotypes.Type, dependentType gotypes.Type) *TypeInfo

func (*TypeDB) LocateTypeInfo

func (t *TypeDB) LocateTypeInfo(locateType gotypes.Type) *TypeInfo

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) WalkAllTypes

func (t *TypeDB) WalkAllTypes(visitor func(t *TypeInfo) error) error

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
}

func (*TypeInfo) String

func (t *TypeInfo) String() string

type TypeMode

type TypeMode int
const (
	TypeStruct TypeMode = TypeMode(iota)
	TypeInterface
	TypeOther
)

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

)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL