Documentation ¶
Index ¶
- func BinOp(b *ssa.BasicBlock) []*ssa.BinOp
- 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 HasField(s *types.Struct, f *types.Var) bool
- func IfInstr(b *ssa.BasicBlock) *ssa.If
- func ImplementsError(t types.Type) bool
- func Imported(pkgPath string, pass *analysis.Pass) 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 ReportWithoutIgnore(pass *analysis.Pass, names ...string) func(analysis.Diagnostic)
- func Returns(v ssa.Value) []*ssa.Return
- func Structs(pkg *types.Package) map[string]*types.Struct
- func TypeOf(pass *analysis.Pass, pkg, name string) types.Type
- func TypesInfo(info ...*types.Info) *types.Info
- type CalledChecker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BinOp ¶ added in v0.0.4
func BinOp(b *ssa.BasicBlock) []*ssa.BinOp
BinOp returns binary operator values which are contained in the block b.
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 information from import path.
func ReportWithoutIgnore ¶ added in v0.1.0
func ReportWithoutIgnore(pass *analysis.Pass, names ...string) func(analysis.Diagnostic)
ReportWithoutIgnore returns a report function which can set to (analysis.Pass).Report. The report function ignores a diagnostic which annotated by ignore comment as the below.
//lint:ignore Check1[,Check2,...,CheckN] reason
names is a list of checker names. If names was omitted, the report function ignores by pass.Analyzer.Name.
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.