astutil

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2022 License: MIT Imports: 8 Imported by: 24

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Apply added in v0.2.0

func Apply(root ast.Node, pre, post ApplyFunc) (result ast.Node)

func CopyExpr added in v0.2.0

func CopyExpr(node ast.Expr) (ast.Expr, bool)

CopyExpr creates a deep copy of an expression. It doesn't support copying FuncLits and returns ok == false when encountering one.

func Equal added in v0.2.0

func Equal(a, b ast.Node) bool

func GroupSpecs

func GroupSpecs(fset *token.FileSet, specs []ast.Spec) [][]ast.Spec

func IsBlank

func IsBlank(id ast.Expr) bool

isBlank returns whether id is the blank identifier "_". If id == nil, the answer is false.

func IsIdent

func IsIdent(expr ast.Expr, ident string) bool

func IsIntLiteral deprecated

func IsIntLiteral(expr ast.Expr, literal string) bool

Deprecated: use code.IsIntegerLiteral instead.

func IsZero deprecated

func IsZero(expr ast.Expr) bool

Deprecated: use IsIntLiteral instead

func PathEnclosingInterval added in v0.2.0

func PathEnclosingInterval(root *ast.File, start, end token.Pos) (path []ast.Node, exact bool)

func Preamble

func Preamble(f *ast.File) string

func Unparen added in v0.2.0

func Unparen(e ast.Expr) ast.Expr

Unparen returns e with any enclosing parentheses stripped.

Types

type ApplyFunc added in v0.2.0

type ApplyFunc = astutil.ApplyFunc

type Cursor added in v0.2.0

type Cursor = astutil.Cursor

Jump to

Keyboard shortcuts

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