pkgx

package
v1.6.5-rc11 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

Variables

This section is empty.

Functions

func FindPkgInfoByPath

func FindPkgInfoByPath(path string, modes ...packages.LoadMode) (*packages.Package, error)

func Import

func Import(path string) string

func ImportPathAndExpose

func ImportPathAndExpose(s string) (string, string)

func IsBlockContainsReturn

func IsBlockContainsReturn(n ast.Node) (ok bool)

func PkgIdByPath

func PkgIdByPath(path string, modes ...packages.LoadMode) (string, error)

func PkgPathByPath

func PkgPathByPath(path string, modes ...packages.LoadMode) (string, error)

func StringifyCommentGroup

func StringifyCommentGroup(cgs ...*ast.CommentGroup) string

func StringifyNode

func StringifyNode(fs *token.FileSet, n ast.Node) string

Types

type CommentScanner

type CommentScanner struct {
	*ast.File
	ast.CommentMap
}

func NewCommentScanner

func NewCommentScanner(fs *token.FileSet, f *ast.File) *CommentScanner

func (*CommentScanner) CommentGroupsOf

func (c *CommentScanner) CommentGroupsOf(n ast.Node) (cgs []*ast.CommentGroup)

func (*CommentScanner) CommentsOf

func (c *CommentScanner) CommentsOf(n ast.Node) string

type End

type End interface{ End() token.Pos }

type Pkg

type Pkg struct {
	*Package
	// contains filtered or unexported fields
}

func LoadFrom

func LoadFrom(pattern string) (*Pkg, error)

func New

func New(pkg *Package) *Pkg

func (*Pkg) AppendResult

func (p *Pkg) AppendResult(res Results, i int, tve TypeAndValueExpr)

func (*Pkg) AssignedValueOf

func (p *Pkg) AssignedValueOf(ident *ast.Ident, pos token.Pos) []TypeAndValueExpr

func (*Pkg) CommentsOf

func (p *Pkg) CommentsOf(n ast.Node) string

func (*Pkg) Const

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

func (*Pkg) Eval

func (p *Pkg) Eval(expr ast.Expr) (types.TypeAndValue, error)

func (*Pkg) FileOf

func (p *Pkg) FileOf(n Pos) *ast.File

func (*Pkg) Func

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

func (*Pkg) FuncDeclOf

func (p *Pkg) FuncDeclOf(fn *types.Func) (decl *ast.FuncDecl)

func (*Pkg) FuncResultsOf

func (p *Pkg) FuncResultsOf(fn *types.Func) (Results, int)

func (*Pkg) FuncResultsOfSignature

func (p *Pkg) FuncResultsOfSignature(sig *types.Signature, body *ast.BlockStmt, ft *ast.FuncType) (Results, int)

func (*Pkg) IdentOf

func (p *Pkg) IdentOf(obj types.Object) *ast.Ident

func (*Pkg) Imports

func (p *Pkg) Imports() []*Package

func (*Pkg) PkgByPath

func (p *Pkg) PkgByPath(path string) *Package

func (*Pkg) PkgByPos

func (p *Pkg) PkgByPos(n Pos) *Package

func (*Pkg) PkgInfoOf

func (p *Pkg) PkgInfoOf(n Pos) *types.Info

func (*Pkg) PkgOf

func (p *Pkg) PkgOf(n Pos) *types.Package

func (*Pkg) ResultsOf

func (p *Pkg) ResultsOf(callee *ast.CallExpr) Results

func (*Pkg) SetResultsByExpr

func (p *Pkg) SetResultsByExpr(res Results, rhs ...ast.Expr)

func (*Pkg) TypeName

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

func (*Pkg) Var

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

type Pos

type Pos interface{ Pos() token.Pos }

type Results

type Results map[int][]TypeAndValueExpr

type Set

type Set map[string]*Package

Set package set, mapping imported package id and package info

func (Set) Append

func (s Set) Append(pkg *Package)

func (Set) List

func (s Set) List() (ret []*Package)

type TypeAndValueExpr

type TypeAndValueExpr struct {
	ast.Expr
	types.TypeAndValue
}

Directories

Path Synopsis
package
package
sub

Jump to

Keyboard shortcuts

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