Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MethodScope ¶
type MethodScope struct {
// contains filtered or unexported fields
}
MethodScope is the sub-registry for allocating variables present in the method scope.
It should be created using a registry instance.
func (*MethodScope) AddVar ¶
func (m *MethodScope) AddVar(vr *types.Var, suffix string) *Var
AddVar allocates a variable instance and adds it to the method scope.
Variables names are generated if required and are ensured to be without conflict with other variables and imported packages. It also adds the relevant imports to the registry for each added variable.
type Package ¶
type Package struct { Alias string // contains filtered or unexported fields }
Package represents an imported package.
func NewPackage ¶
NewPackage creates a new instance of Package.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry encapsulates types information for the source and mock destination package. For the mock package, it tracks the list of imports and ensures there are no conflicts in the imported package qualifiers.
func (*Registry) AddImport ¶
AddImport adds the given package to the set of imports. It generates a suitable alias if there are any conflicts with previously imported packages.
func (Registry) Imports ¶
Imports returns the list of imported packages. The list is sorted by path.
func (Registry) LookupInterface ¶
LookupInterface returns the underlying interface definition of the given interface name.
func (*Registry) MethodScope ¶
func (r *Registry) MethodScope() *MethodScope
MethodScope returns a new MethodScope.
func (Registry) SrcPkgName ¶
SrcPkgName returns the name of the source package.
type Var ¶
type Var struct { Name string // contains filtered or unexported fields }
Var represents a method variable/parameter.
It should be created using a method scope instance.
func (Var) TypeString ¶
TypeString returns the variable type with the package qualifier in the format 'pkg.Type'.