gosyntax

package
v0.1.10 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2023 License: MIT Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExprDeclString

func ExprDeclString(fset *token.FileSet, e ast.Expr) string

ExprDeclString returns declarative string for AST Expr object

func ForEachDeclInPackage

func ForEachDeclInPackage(
	p *packages.Package,
	do func(ast.Decl),
)

ForEachDeclInPackage iterates all AST Decl objects in a AST syntactic package

func ForEachFuncDeclInFile

func ForEachFuncDeclInFile(
	file *ast.File,
	do func(*ast.FuncDecl),
)

func ForEachFuncDeclInPackage

func ForEachFuncDeclInPackage(
	p *packages.Package,
	do func(*ast.FuncDecl),
)

ForEachFuncDeclInPackage iterates all AST FuncDecl objects in a AST syntactic package

func ForEachInterfaceDeclInFile

func ForEachInterfaceDeclInFile(file *ast.File,
	do func(name string, methods []*ast.Field),
)

func ForEachInterfaceDeclInPackage

func ForEachInterfaceDeclInPackage(
	p *packages.Package,
	do func(name string, methods []*ast.Field),
)

func FuncDeclString

func FuncDeclString(fset *token.FileSet, fn *ast.FuncDecl) string

func ParamInfoListDeclString

func ParamInfoListDeclString(params []*FieldDeclInfo) string

func ParamInfoListFixup

func ParamInfoListFixup(paramInfos []*FieldDeclInfo)

func ParamInfoListInvokeString added in v0.1.6

func ParamInfoListInvokeString(params []*FieldDeclInfo) string

func ParamInfoListNameExists

func ParamInfoListNameExists(paramInfos []*FieldDeclInfo, name string) bool

func ParamInfoListTypeOnlyDeclString added in v0.1.6

func ParamInfoListTypeOnlyDeclString(paramInfos []*FieldDeclInfo) string

ParamInfoListTypeOnlyDeclString returns declarative string from parameter field declarations, the returned declarative string contains only type declarations

func ParamListDeclString

func ParamListDeclString(fset *token.FileSet, fl *ast.FieldList) string

ParamListDeclString returns declarative string for AST FieldList object

func ReceiverDeclString

func ReceiverDeclString(fset *token.FileSet, fl *ast.FieldList) string

func ReturnDeclString

func ReturnDeclString(fset *token.FileSet, fl *ast.FieldList) string

ReturnDeclString returns declative string for the given AST field list

func ReturnInfoListDeclString added in v0.1.6

func ReturnInfoListDeclString(returns []*FieldDeclInfo) string

ReturnInfoListDeclString returns declative string for the given return info list

Types

type FieldDeclInfo

type FieldDeclInfo struct {
	Name     string
	Typ      string
	Variadic bool
}

unify AST field list with simplified struct. Original thought was to give an common interface for syntax-based and type-based implementations

func ParamListDeclInfo

func ParamListDeclInfo(fset *token.FileSet, fl *ast.FieldList) []*FieldDeclInfo

Jump to

Keyboard shortcuts

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