Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var InspectorAnalyzer = &Analyzer{ Run: func(pass *Pass) interface{} { return ast.NewInspector(pass.Program.Program) }, }
Functions ¶
This section is empty.
Types ¶
type Analyzer ¶
type Analyzer struct { Description string Run func(*Pass) interface{} // Requires is a set of analyzers that must run before this one. // This analyzer may inspect the outputs produced by each analyzer in Requires. // The graph over analyzers implied by Requires edges must be acyclic Requires []*Analyzer }
Analyzer describes an analysis function and its options
type Config ¶
type Config struct { // ResolveAddressContractNames is called to resolve the contract names of an address location ResolveAddressContractNames func(address common.Address) ([]string, error) // ResolveCode is called to resolve an import to its source code ResolveCode func( location common.Location, importingLocation common.Location, importRange ast.Range, ) ([]byte, error) // Mode controls the level of information returned for each program Mode LoadMode }
A Config specifies details about how programs should be loaded. The zero value is a valid configuration. Calls to Load do not modify this struct.
type Diagnostic ¶
type Diagnostic struct { Location common.Location Category string Message string SecondaryMessage string SuggestedFixes []SuggestedFix ast.Range }
func (Diagnostic) SuggestFixes ¶ added in v0.40.0
func (d Diagnostic) SuggestFixes(_ string) []SuggestedFix
type LoadMode ¶
type LoadMode int
LoadMode controls the amount of detail to return when loading. The bits below can be combined to specify what information is required.
const ( // NeedSyntax provides the AST. NeedSyntax LoadMode = 0 // NeedTypes provides the elaboration. NeedTypes LoadMode = 1 << iota // NeedPositionInfo provides position information (e.g. occurrences). NeedPositionInfo // NeedExtendedElaboration provides an extended elaboration. NeedExtendedElaboration )
type ParsingCheckingError ¶
type ParsingCheckingError struct {
// contains filtered or unexported fields
}
func (ParsingCheckingError) ChildErrors ¶
func (e ParsingCheckingError) ChildErrors() []error
func (ParsingCheckingError) ImportLocation ¶
func (e ParsingCheckingError) ImportLocation() common.Location
func (ParsingCheckingError) Unwrap ¶
func (e ParsingCheckingError) Unwrap() error
type Pass ¶
type Pass struct { Program *Program // Report reports a Diagnostic, a finding about a specific location // in the analyzed source code such as a potential mistake. // It may be called by the Analyzer.Run function. Report func(Diagnostic) // ResultOf provides the inputs to this analysis pass, // which are the corresponding results of its prerequisite analyzers. // The map keys are the elements of Analyzer.Requires. ResultOf map[*Analyzer]interface{} }
Pass provides information to the Analyzer.Run function, which applies a specific analyzer to a single location.
type Program ¶
type Program struct { Location common.Location Program *ast.Program Elaboration *sema.Elaboration Code []byte }
func (*Program) Run ¶
func (program *Program) Run(analyzers []*Analyzer, report func(Diagnostic))
Run runs the given DAG of analyzers in parallel
type SuggestedFix ¶ added in v0.39.6
type SuggestedFix = sema.SuggestedFix
Click to show internal directories.
Click to hide internal directories.