collect

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2023 License: MIT Imports: 6 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Collector

type Collector struct {
	Fset  *token.FileSet
	Dot   string
	Sharp string
}

func (*Collector) CollectFromFile

func (c *Collector) CollectFromFile(f *File, t *ast.File) error

func (*Collector) CollectFromFuncDecl

func (c *Collector) CollectFromFuncDecl(f *File, t *ast.File, decl *ast.FuncDecl) error

func (*Collector) CollectFromGenDecl

func (c *Collector) CollectFromGenDecl(f *File, decl *ast.GenDecl) error

func (*Collector) CollectFromInterfaceType

func (c *Collector) CollectFromInterfaceType(f *File, s *Object, decl *ast.GenDecl, spec *ast.TypeSpec, typ *ast.InterfaceType) error

func (*Collector) CollectFromPackage

func (c *Collector) CollectFromPackage(p *Package, t *ast.Package) error

func (*Collector) CollectFromStructType

func (c *Collector) CollectFromStructType(f *File, s *Object, decl *ast.GenDecl, spec *ast.TypeSpec, typ *ast.StructType) error

func (*Collector) CollectFromTypeSpec

func (c *Collector) CollectFromTypeSpec(f *File, decl *ast.GenDecl, spec *ast.TypeSpec) error

type Field

type Field struct {
	Name      string    `json:"name"`
	Pos       token.Pos `json:"-"`
	Embedded  bool      `json:"embedded"`
	Anonymous *Object   `json:"annonymous,omitempty"`

	Doc     string `json:"doc"`     // associated documentation; or nil
	Comment string `json:"comment"` // line comments; or nil
}

type File

type File struct {
	Interfaces map[string]*Object `json:"interfaces"`
	Functions  map[string]*Func   `json:"functions"`
	Types      map[string]*Object `json:"types"`
	Names      []string           `json:"names"`
}

func NewFile

func NewFile() *File

type Func

type Func struct {
	Name string    `json:"name"`
	Pos  token.Pos `json:"-"`

	Recv string `json:"recv,omitempty"`

	Params     map[string]*Field `json:"params"`
	ParamNames []string          `json:"paramnames"`

	Returns     map[string]*Field `json:"returns"`
	ReturnNames []string          `json:"returnnames"`

	Doc string `json:"doc"` // associated documentation; or nil (decl or spec?)
}

type Object

type Object struct {
	Name   string      `json:"name"`
	Pos    token.Pos   `json:"-"`
	Token  token.Token `json:"-"`
	Parent *Object     `json:"-"`

	Fields     map[string]*Field `json:"fields,omitempty"`
	FieldNames []string          `json:"fieldnames,omitempty"`

	Methods     map[string]*Func `json:"methods,omitempty"`
	MethodNames []string         `json:"methodnames,omitempty"`

	Doc     string `json:"doc"`     // associated documentation; or nil (decl or spec?)
	Comment string `json:"comment"` // line comments; or nil
}

type Package

type Package struct {
	Files      map[string]*File   `json:"-"`
	Interfaces map[string]*Object `json:"interfaces"`
	Functions  map[string]*Func   `json:"functions"`
	Types      map[string]*Object `json:"types"`

	FileNames []string `json:"filenames"`
	Names     []string `json:"names"`
}

func NewPackage

func NewPackage() *Package

type PackageBuilder

type PackageBuilder struct {
	Package *Package

	EnableMergeMethod bool
	IgnoreExported    bool
}

func (*PackageBuilder) AddFile

func (b *PackageBuilder) AddFile(f *File, filename string)

func (*PackageBuilder) Build

func (b *PackageBuilder) Build() *Package

Jump to

Keyboard shortcuts

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