functioncontracts

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

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.

Jump to

Keyboard shortcuts

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