helper

package
v0.0.0-...-11dab80 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteImport

func DeleteImport(fset *token.FileSet, f *ast.File, path string) (deleted bool)

DeleteImport deletes the import with the given path (ignoring the name) from the file f, if present. If there are duplicate import declarations, all matching ones are deleted. modified from https://github.com/golang/tools/blob/master/go/ast/astutil/imports.go#L210

func Imported

func Imported(f *ast.File, path string) bool

Imported package by path, whatever the name is

Types

type ErrorHandler

type ErrorHandler func(pos loader.Positioner, msg string)

type JumpTable

type JumpTable map[*ast.BranchStmt]ast.Stmt

JumpTable when branch is token.GOTO then stmt is *ast.LabeledStmt when branch is labeld token.CONTINUE then stmt is *ast.ForStmt, *ast.RangeStmt when branch is labeld token.BREAK then stmt is *ast.SwitchStmt, *ast.TypeSwitchStmt, *ast.SelectStmt, *ast.ForStmt, *ast.RangeStmt

func Target

func Target(body *ast.BlockStmt, errh ErrorHandler) JumpTable

func (JumpTable) JumpTo

func (t JumpTable) JumpTo(s *ast.BranchStmt, target ast.Stmt) bool

type TerminationChecker

type TerminationChecker struct {
	// contains filtered or unexported fields
}

func NewTerminationChecker

func NewTerminationChecker(panicCallSites map[*ast.CallExpr]bool) *TerminationChecker

func (*TerminationChecker) IsTerminating

func (t *TerminationChecker) IsTerminating(s ast.Stmt, label string) bool

IsTerminating reports if s is a terminating statement. If s is labeled, label is the label name; otherwise s is "".

Jump to

Keyboard shortcuts

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