Documentation ¶
Overview ¶
Package functioncontracts implements a sub-analyzer to analyze function contracts in a package, i.e., parsing specified function contracts written as special comments before function declarations, or automatically inferring function contracts from the function body.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Analyzer = &analysis.Analyzer{ Name: "nilaway_function_contracts_analyzer", Doc: _doc, Run: analysishelper.WrapRun(run), ResultType: reflect.TypeOf((*analysishelper.Result[Map])(nil)), Requires: []*analysis.Analyzer{config.Analyzer, buildssa.Analyzer}, }
Analyzer here is the analyzer than reads function contracts. It returns the map generated from reading the function contracts in the source code.
Functions ¶
This section is empty.
Types ¶
type ContractVal ¶
type ContractVal string
ContractVal represents the possible value appearing in a function contract.
const ( // NonNil has keyword "nonnil". NonNil ContractVal = "nonnil" // False has keyword "false". False ContractVal = "false" // True has keyword "true". True ContractVal = "true" // Any has keyword "_". Any ContractVal = "_" )
type FunctionContract ¶
type FunctionContract struct { Ins []ContractVal Outs []ContractVal }
FunctionContract represents a function contract.
type Map ¶
type Map map[*types.Func][]*FunctionContract
Map stores the mappings from *types.Func to associated function contracts.
Click to show internal directories.
Click to hide internal directories.