astutil

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2022 License: MIT Imports: 13 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// 开了缓存,ops 可以提高三个数量级
	OptPackageCache = true
)
View Source
var (
	OptReturnOnError = true
)

Functions

func DisableLog added in v0.5.7

func DisableLog()

func EnableLog added in v0.5.7

func EnableLog()

func ExprString

func ExprString(expr ast.Expr) (name string)

ExprString generates code by ast.Expr like printer.Fprint() 经过拼装,可能与源码不完全一致 TODO 2019.9.28 最开始不知道有 printer 这个包,手写了一坨,后面可能会直接接过去。。 Deprecated

func Find added in v0.5.7

func Find(parent ast.Node, queries []interface{}) (children []ast.Node, err error)

Find returns a slice of sub-nodes like jQuery

func Name added in v0.5.7

func Name(node ast.Node) string

func ReadPackage added in v0.5.6

func ReadPackage(pkgPath string) (pkg *ast.Package, err error)

ReadPackage is simple wrapper for parserDir use pkgName with last segment in pkgPath

func ReadPackageWithName added in v0.5.6

func ReadPackageWithName(pkgPath string, pkgName string, fileScope string, filter func(os.FileInfo) bool) (pkg *ast.Package, err error)

ReadPackageWithName read package with specified package name fileScope used for cache key

func SetLogOutput added in v0.5.7

func SetLogOutput(writer io.Writer)

func SrcOf added in v0.5.7

func SrcOf(node ast.Node) string

SrcOf print ast.Node to a string

Types

type Writer added in v0.5.7

type Writer struct {
	io.Writer
}

func (*Writer) SetOutput added in v0.5.7

func (w *Writer) SetOutput(writer io.Writer)

func (*Writer) Write added in v0.5.7

func (w *Writer) Write(p []byte) (n int, err error)

Jump to

Keyboard shortcuts

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