Documentation
¶
Overview ¶
Package astutil provides analysis utilities for the scopeguard analyzer. It includes helpers for file context management, AST node iteration, and error reporting.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllAssigned ¶ added in v0.0.5
AllAssigned yields all assigned identifiers.
func AllDeclared ¶ added in v0.0.5
AllDeclared yields all declared identifiers.
func CommentHasNoLint ¶
CommentHasNoLint checks if the provided comment contains a `//nolint:scopeguard` directive.
Types ¶
type CurrentFile ¶
type CurrentFile struct {
// contains filtered or unexported fields
}
CurrentFile holds file information for analysis.
func NewCurrentFile ¶
func NewCurrentFile(fset *token.FileSet, file *ast.File) CurrentFile
NewCurrentFile creates a new CurrentFile from a token.FileSet and an *ast.File.
func (CurrentFile) Generated ¶
func (c CurrentFile) Generated() bool
Generated returns true if the file is a generated file.
func (CurrentFile) Lines ¶
func (c CurrentFile) Lines(stmt ast.Node) int
Lines returns the number of Lines a statement spans.
func (CurrentFile) NoLintComment ¶
func (c CurrentFile) NoLintComment(pos token.Pos) bool
NoLintComment checks if a line is followed by a //nolint:scopeguard comment.
func (CurrentFile) Valid ¶
func (c CurrentFile) Valid() bool
Valid returns true if the CurrentFile was successfully created from a valid file handle.
type NodeIndex ¶
type NodeIndex int32
NodeIndex is the index from inspector.Cursor, increases monotonically throughout the traversal.
const InvalidNode NodeIndex = -1
InvalidNode represents an invalid node index.
func NodeIndexOf ¶
NodeIndexOf returns the NodeIndex for the current inspector.Cursor position.
func (NodeIndex) Cursor ¶
Cursor returns the inspector.Cursor corresponding to this index.