analysis

package
v1.2.5 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2021 License: BSD-2-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BoolValue

func BoolValue(expr ast.Expr, info *types.Info) (bool, bool)

func EscapingObjects

func EscapingObjects(n ast.Node, info *types.Info) []*types.Var

func HasBreak

func HasBreak(n ast.Node) bool

func HasSideEffect

func HasSideEffect(n ast.Node, info *types.Info) bool

Types

type FuncInfo

type FuncInfo struct {
	HasDefer bool
	// Flattened map tracks which AST nodes within function body must be
	// translated into re-enterant blocks.
	//
	// Function body needs to be "flattened" if an option to jump an arbitrary
	// position in the code is required. Typical examples are a "goto" operator or
	// resuming goroutine execution after a blocking call.
	Flattened map[ast.Node]bool
	// Blocking map tracks which AST nodes lead to potentially blocking calls.
	//
	// Blocking calls require special handling on JS side to avoid blocking the
	// event loop and freezing the page.
	Blocking map[ast.Node]bool
	// GotoLabel keeps track of labels referenced by a goto operator.
	//
	// JS doesn't support "goto" natively and it needs to be emulated with a
	// switch/case statement. This is distinct from labeled loop statements, which
	// have native JS syntax and don't require special handling.
	GotoLabel map[*types.Label]bool
	// contains filtered or unexported fields
}

func (*FuncInfo) Visit

func (c *FuncInfo) Visit(node ast.Node) ast.Visitor

type Info

type Info struct {
	*types.Info
	Pkg           *types.Package
	IsBlocking    func(*types.Func) bool
	HasPointer    map[*types.Var]bool
	FuncDeclInfos map[*types.Func]*FuncInfo
	FuncLitInfos  map[*ast.FuncLit]*FuncInfo
	InitFuncInfo  *FuncInfo
	// contains filtered or unexported fields
}

func AnalyzePkg

func AnalyzePkg(files []*ast.File, fileSet *token.FileSet, typesInfo *types.Info, typesPkg *types.Package, isBlocking func(*types.Func) bool) *Info

Jump to

Keyboard shortcuts

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