wallylib

package
v0.0.0-...-2c9b28d Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2024 License: MPL-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DedupPaths

func DedupPaths(paths [][]string) [][]string

func Equal

func Equal(a, b []string) bool

func GetExprsFromStmt

func GetExprsFromStmt(stmt ast.Stmt) []*ast.CallExpr

TODO: Lots of repeated code that we can refactor here Further, this is likely not sufficient if used for more general purposes (outside wally) as there are parts of some statements (i.e. a ForStmt Post) that are not handled here

func GetFormattedPos

func GetFormattedPos(pkg *ssa.Package, pos token.Pos) string

func GetFuncSignature

func GetFuncSignature(expr ast.Expr, info *types.Info) (*types.Signature, error)

func GetFunctionFromCallInstruction

func GetFunctionFromCallInstruction(callInstr ssa.CallInstruction) *ssa.Function

func GetFunctionFromSite

func GetFunctionFromSite(site ssa.CallInstruction) *ssa.Function

func GetName

func GetName(e ast.Expr) string

func GetParamPos

func GetParamPos(sig *types.Signature, paramName string) (int, error)

func GetValueFromExp

func GetValueFromExp(exp ast.Expr, pass *analysis.Pass) string

func IsClosure

func IsClosure(function *ssa.Function) bool

func ResolvePackageFromIdent

func ResolvePackageFromIdent(expr ast.Expr, info *types.Info) (*types.Package, error)

ResolvePackageFromIdent TODO: This may be useful to get receiver type of func Also, wrong name, its from an Expr, not from Idt, technically

func ResolveParamFromName

func ResolveParamFromName(name string, sig *types.Signature, param *ast.CallExpr, pass *analysis.Pass) string

func ResolveParamFromPos

func ResolveParamFromPos(pos int, param *ast.CallExpr, pass *analysis.Pass) string

func ResolveParams

func ResolveParams(params []indicator.RouteParam, sig *types.Signature, ce *ast.CallExpr, pass *analysis.Pass) map[string]string

func SiteMatchesFunc

func SiteMatchesFunc(site ssa.CallInstruction, function *ssa.Function) bool

Types

type FuncDecl

type FuncDecl struct {
	Pkg  *types.Package
	Decl *ast.FuncDecl
}

func (*FuncDecl) String

func (f *FuncDecl) String() string

type FuncInfo

type FuncInfo struct {
	Package    string
	Pkg        *types.Package
	Type       string
	Name       string
	Route      string
	Signature  *types.Signature
	EnclosedBy *FuncDecl
}

func GetFuncInfo

func GetFuncInfo(expr ast.Expr, info *types.Info) (*FuncInfo, error)

func (*FuncInfo) Match

func (fi *FuncInfo) Match(indicators []indicator.Indicator) *indicator.Indicator

type SSAContext

type SSAContext struct {
	EnclosedByFunc *ssa.Function
	Edges          []*callgraph.Edge
	CallPaths      [][]string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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