ast

package
v0.0.0-...-dde2fb4 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyFuncDeclsAsDecl

func CopyFuncDeclsAsDecl(funcDecls []*ast.FuncDecl) (newFuncDecls []ast.Decl)

func ExtractObjectsFromFuncDeclRecursive

func ExtractObjectsFromFuncDeclRecursive(pkgs map[string]*packages.Package, f *types.Func, objects []types.Object) ([]types.Object, error)

func GenDeclToDecl

func GenDeclToDecl(genDecls []*ast.GenDecl) (decls []ast.Decl)

func SortFuncDeclsFromDecls

func SortFuncDeclsFromDecls(decls []ast.Decl) []ast.Decl

func SortGenDecls

func SortGenDecls(genDecls []*ast.GenDecl)

Types

type Packages

type Packages struct {
	Packages map[string]*packages.Package
}

func NewPackages

func NewPackages(pkgs []*packages.Package) *Packages

func NewPackagesFromPackageNames

func NewPackagesFromPackageNames(packageNames []string) (*Packages, *token.FileSet, error)

func (*Packages) FindDeclByObject

func (p *Packages) FindDeclByObject(object types.Object) ast.Decl

func (*Packages) FindPkgByName

func (p *Packages) FindPkgByName(name string) (*packages.Package, bool)

func (*Packages) ObjectsToDecls

func (p *Packages) ObjectsToDecls(objects []types.Object) []ast.Decl

type Program

type Program struct {
	Packages      *Packages
	Objects       []types.Object
	Decls         []ast.Decl
	ImportObjects []types.Object
	Imports       []*ast.GenDecl
	ConstObjects  []types.Object
	Const         *ast.GenDecl
	TypeObjects   []types.Object
	Types         []*ast.GenDecl
	VarObjects    []types.Object
	Vars          []*ast.GenDecl
	FuncObjects   []types.Object
	Funcs         []*ast.FuncDecl
}

func NewProgram

func NewProgram(pkgs *Packages, objects []types.Object) *Program

func (*Program) Bundle

func (p *Program) Bundle(files []*ast.File) *ast.File

Jump to

Keyboard shortcuts

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