Documentation ¶
Index ¶
- func Called(instr ssa.Instruction, recv ssa.Value, f *types.Func) bool
- func CalledFrom(b *ssa.BasicBlock, i int, receiver types.Type, methods ...*types.Func) (called, ok bool)
- func File(pass *analysis.Pass, pos token.Pos) *ast.File
- func IfInstr(b *ssa.BasicBlock) *ssa.If
- func ImplementsError(t types.Type) bool
- func Interfaces(pkg *types.Package) map[string]*types.Interface
- func LookupFromImports(imports []*types.Package, path, name string) types.Object
- func MethodOf(typ types.Type, name string) *types.Func
- func ObjectOf(pass *analysis.Pass, pkg, name string) types.Object
- func Phi(b *ssa.BasicBlock) (phis []*ssa.Phi)
- func RemoveVendor(path string) string
- func Returns(v ssa.Value) []*ssa.Return
- func TypeOf(pass *analysis.Pass, pkg, name string) types.Type
- type CalledChecker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Called ¶
Called returns true when f is called in the instr. If recv is not nil, Called also checks the receiver.
func CalledFrom ¶
func CalledFrom(b *ssa.BasicBlock, i int, receiver types.Type, methods ...*types.Func) (called, ok bool)
CalledFrom checks whether receiver's method is called in an instruction which belogns to after i-th instructions, or in succsor blocks of b. The first result is above value. The second result is whether type of i-th instruction does not much receiver or matches with ignore cases.
func IfInstr ¶
func IfInstr(b *ssa.BasicBlock) *ssa.If
IfInstr returns *ssa.If which is contained in the block b. If the block b has not any if instruction, IfInstr returns nil.
func ImplementsError ¶
ImplementsError return whether t implements error interface.
func Interfaces ¶
Interfaces returns a map of interfaces which are declared in the package.
func LookupFromImports ¶
LookupFromImports finds an object from import paths.
func Phi ¶
func Phi(b *ssa.BasicBlock) (phis []*ssa.Phi)
Phi returns phi values which are contained in the block b.
func RemoveVendor ¶
RemoVendor removes vendoring infomation from import path.
Types ¶
type CalledChecker ¶
type CalledChecker struct {
Ignore func(instr ssa.Instruction) bool
}
CalledChecker checks a function is called. See From and Func.
func (*CalledChecker) From ¶
func (c *CalledChecker) From(b *ssa.BasicBlock, i int, receiver types.Type, methods ...*types.Func) (called, ok bool)
From checks whether receiver's method is called in an instruction which belogns to after i-th instructions, or in succsor blocks of b. The first result is above value. The second result is whether type of i-th instruction does not much receiver or matches with ignore cases.
func (*CalledChecker) Func ¶
func (c *CalledChecker) Func(instr ssa.Instruction, recv ssa.Value, f *types.Func) bool
Func returns true when f is called in the instr. If recv is not nil, Called also checks the receiver.