packagex

package
v1.0.16 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Deref

func Deref(tpe types.Type) types.Type

func GetIdentChainOfCallFunc

func GetIdentChainOfCallFunc(expr ast.Expr) (list []*ast.Ident)

func GetPkgImportPathAndExpose

func GetPkgImportPathAndExpose(s string) (string, string)

func ImportGoPath

func ImportGoPath(importPath string) string

func StringifyCommentGroup

func StringifyCommentGroup(commentGroupList ...*ast.CommentGroup) (comments string)

func StringifyNode

func StringifyNode(fset *token.FileSet, node ast.Node) string

Types

type CommentScanner

type CommentScanner struct {
	CommentMap ast.CommentMap
	// contains filtered or unexported fields
}

func NewCommentScanner

func NewCommentScanner(fileSet *token.FileSet, file *ast.File) *CommentScanner

func (*CommentScanner) CommentGroupListOf

func (scanner *CommentScanner) CommentGroupListOf(targetNode ast.Node) (commentGroupList []*ast.CommentGroup)

func (*CommentScanner) CommentsOf

func (scanner *CommentScanner) CommentsOf(targetNode ast.Node) string

type Package

type Package struct {
	*packages.Package
	AllPackages []*packages.Package
}

func Load

func Load(pattern string) (*Package, error)

func LoadFrom

func LoadFrom(pattern, path string) (*Package, error)

func NewPackage

func NewPackage(pkg *packages.Package) *Package

func (*Package) CommentsOf

func (prog *Package) CommentsOf(node ast.Node) string

func (*Package) Const

func (p *Package) Const(name string) *types.Const

func (*Package) Eval

func (prog *Package) Eval(expr ast.Expr) (types.TypeAndValue, error)

func (*Package) FileOf

func (prog *Package) FileOf(poser Poser) *ast.File

func (*Package) Func

func (p *Package) Func(name string) *types.Func

func (*Package) FuncDeclOf

func (prog *Package) FuncDeclOf(typeFunc *types.Func) (funcDecl *ast.FuncDecl)

func (*Package) FuncResultsOf

func (prog *Package) FuncResultsOf(typeFunc *types.Func) (Results, int)

func (*Package) FuncResultsOfSignature

func (prog *Package) FuncResultsOfSignature(signature *types.Signature, funcBody *ast.BlockStmt, astFuncType *ast.FuncType) (Results, int)

func (*Package) IdentOf

func (prog *Package) IdentOf(obj types.Object) *ast.Ident

func (*Package) Pkg

func (prog *Package) Pkg(importPath string) *packages.Package

func (*Package) PkgInfoOf

func (prog *Package) PkgInfoOf(poser Poser) *types.Info

func (*Package) PkgOf

func (prog *Package) PkgOf(poser Poser) *types.Package

func (*Package) TypeName

func (p *Package) TypeName(name string) *types.TypeName

func (*Package) Var

func (p *Package) Var(name string) *types.Var

type Poser

type Poser interface {
	Pos() token.Pos
}

type Results

type Results map[int][]TypeAndValueWithExpr

type TypeAndValueWithExpr

type TypeAndValueWithExpr struct {
	Expr ast.Expr
	types.TypeAndValue
}

Jump to

Keyboard shortcuts

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