Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DeclarationNode ¶ added in v0.0.5
DeclarationNode tracks a (re-)declaration node and its usages.
type Diagnostics ¶
type Diagnostics struct {
Shadows []ShadowUse
Nested []NestedAssign
}
Diagnostics contains findings from the usage analysis stage.
type Flags ¶
type Flags uint8
Flags indicate how a variable is used.
const ( // UsageUsed indicates the variable declaration is used. UsageUsed Flags = 1 << iota // UsageTypeChange indicates the variable redeclaration implies a type change. UsageTypeChange // UsageUntypedNil indicates the variable redeclaration is assigned to untyped nil. UsageUntypedNil // UsageNone indicates the variable redeclaration is unused. UsageNone Flags = 0 // UsageUsedAndTypeChange represents a combination of [UsageUsed] and [UsageTypeChange] flags. UsageUsedAndTypeChange = UsageUsed | UsageTypeChange )
func (Flags) TypeChange ¶
TypeChange indicates the variable redeclaration implies a type change.
func (Flags) UntypedNil ¶
UntypedNil indicates the variable redeclaration is assigned to untyped nil.
func (Flags) UsedAndTypeChange ¶
UsedAndTypeChange represents a combination of Flags.Used and Flags.TypeChange.
type NestedAssign ¶
type NestedAssign = check.NestedAssign
NestedAssign contains information about a nested variable assign.
type Result ¶
type Result struct {
// contains filtered or unexported fields
}
Result contains the scope analysis for all variable declarations from stage 1.
func (Result) AllDeclarations ¶ added in v0.0.5
AllDeclarations returns an iterator over all variables and their corresponding usage lists.
func (Result) AllScopeRanges ¶
AllScopeRanges returns all scope ranges in the result.
func (Result) HasScopeRanges ¶
HasScopeRanges checks if any scope ranges are present in the result.
type ScopeRange ¶
type ScopeRange struct {
// Decl is the scope where the variable was declared
Decl,
Usage *types.Scope
}
ScopeRange represents the scope range for a declaration.
type Stage ¶
type Stage struct {
*analysis.Pass
scope.UsageScope
// contains filtered or unexported fields
}
Stage configures and runs the usage analysis stage. It captures the analysis pass context and configuration to instantiate a usageCollector.