Help us shape the future of Go! Take the 2026 Go Developer Survey

astutil

package
v1.17.2 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2022 License: BSD-2-Clause Imports: 5 Imported by: 103

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EndsWithReturn added in v1.17.2

func EndsWithReturn(stmts []ast.Stmt) bool

EndsWithReturn returns true if the last effective statement is a "return".

func FindLoopStmt added in v1.17.2

func FindLoopStmt(stack []ast.Node, branch *ast.BranchStmt, typeInfo *types.Info) ast.Stmt

FindLoopStmt tries to find the loop statement among the AST nodes in the |stack| that corresponds to the break/continue statement represented by branch.

This function is label-aware and assumes the code was successfully type-checked.

func FuncKey added in v1.17.2

func FuncKey(d *ast.FuncDecl) string

FuncKey returns a string, which uniquely identifies a top-level function or method in a package.

func ImportsUnsafe added in v1.17.2

func ImportsUnsafe(file *ast.File) bool

func IsTypeExpr

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

func NewIdent

func NewIdent(name string, t types.Type, info *types.Info, pkg *types.Package) *ast.Ident

func PruneOriginal added in v1.17.2

func PruneOriginal(d *ast.FuncDecl) bool

PruneOriginal returns true if gopherjs:prune-original directive is present before a function decl.

`//gopherjs:prune-original` is a GopherJS-specific directive, which can be applied to functions in native overlays and will instruct the augmentation logic to delete the body of a standard library function that was replaced. This directive can be used to remove code that would be invalid in GopherJS, such as code expecting ints to be 64-bit. It should be used with caution since it may create unused imports in the original source file.

func RemoveParens

func RemoveParens(e ast.Expr) ast.Expr

func SetType

func SetType(info *types.Info, t types.Type, e ast.Expr) ast.Expr

Types

This section is empty.

Jump to

Keyboard shortcuts

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