Documentation
¶
Overview ¶
Package anonymousfunc implements a sub-analyzer to analyze anonymous functions in a package.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Analyzer = &analysis.Analyzer{ Name: "nilaway_anonymous_func_analyzer", Doc: _doc, Run: analysishelper.WrapRun(run), ResultType: reflect.TypeOf((*analysishelper.Result[map[*ast.FuncLit]*FuncLitInfo])(nil)), Requires: []*analysis.Analyzer{config.Analyzer}, }
Analyzer collects a set of variables from closure for each function literal
Functions ¶
This section is empty.
Types ¶
type FuncLitInfo ¶
type FuncLitInfo struct {
// FakeFuncDecl is the fake func decl node created for the func lit node so that it can be
// treated like a regular function declaration during the analysis. The parameter list is
// extended to include variables used from the closure.
FakeFuncDecl *ast.FuncDecl
// FakeFuncObj is the fake object for the fake func decl node.
FakeFuncObj *types.Func
// ClosureVars stores a slice of assigned / accessed variables from closure within each
// function literal in the order of their appearances.
ClosureVars []*VarInfo
}
FuncLitInfo is the struct that stores auxiliary information (e.g., the closure variables it uses, its corresponding fake func decl node, etc.) about a func lit that is useful in the main analysis.
type VarInfo ¶
type VarInfo struct {
// Ident stores the ident node.
Ident *ast.Ident
// Obj stores the named entity of the variable.
Obj *types.Var
}
VarInfo keeps the information about a variable (*ast.Ident) and its associated object type (*types.Var). It can either be a real identifier we collected from the analysis, or a fake one we created to aid the analysis.
Click to show internal directories.
Click to hide internal directories.