symbols

package module
v0.0.0-...-1295d18 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2019 License: MIT Imports: 13 Imported by: 2

Documentation

Index

Constants

View Source
const All = -1

Variables

This section is empty.

Functions

func ArrayItem

func ArrayItem(node ast.Node) ast.Node

func IsArray

func IsArray(node ast.Node) bool

func IsCall

func IsCall(node ast.Node) bool

func IsConstant

func IsConstant(node ast.Node) bool

func IsFunction

func IsFunction(node ast.Node) bool

func IsIdent

func IsIdent(node ast.Node) bool

func IsInterface

func IsInterface(node ast.Node) bool

func IsLiteral

func IsLiteral(node ast.Node) bool

func IsMap

func IsMap(node ast.Node) bool

func IsPointer

func IsPointer(node ast.Node) bool

func IsStruct

func IsStruct(node ast.Node) bool

func IsStructDefinition

func IsStructDefinition(node ast.Node) bool

func IsType

func IsType(node ast.Node) bool

func IsVariable

func IsVariable(node ast.Node) bool

func Literal

func Literal(node ast.Node) (string, error)

Types

type Field

type Field struct {
	Name    string
	Type    *Symbol
	RawType ast.Expr
	Raw     *ast.Field
	Parent  *ast.TypeSpec
	Tags    map[string]string
}

func (*Field) Comment

func (f *Field) Comment() string

type File

type File struct {
	Filename string
	Import   string
	Ast      *ast.File
}

func (*File) FindSymbol

func (f *File) FindSymbol(targetName string) *Node

func (*File) Imports

func (f *File) Imports() []string

func (*File) Symbols

func (f *File) Symbols(walk func(node ast.Node, f *File, name string) error) error

func (*File) SymbolsNames

func (f *File) SymbolsNames() []string

type Function

type Function struct {
	Name string
	Raw  *ast.FuncDecl
}

type Import

type Import struct {
	Import    string
	Package   string
	Directory string
	Files     []*File
}

func (*Import) FindFile

func (imp *Import) FindFile(name string) *File

func (*Import) FindSymbol

func (imp *Import) FindSymbol(name string) *Symbol

func (*Import) Symbols

func (imp *Import) Symbols(walk func(sym *Symbol) error) error

type ImportNotFoundErr

type ImportNotFoundErr string

func (*ImportNotFoundErr) Error

func (in *ImportNotFoundErr) Error() string

type Imports

type Imports []Import

func Scan

func Scan(dir string, limit int) (Imports, error)

func ScanPackage

func ScanPackage(importPath string, limit int) (Imports, error)

func (Imports) ByFile

func (imps Imports) ByFile(f *File) Imports

func (Imports) ByImport

func (imps Imports) ByImport(packageImport string) *Import

func (Imports) ByPackageName

func (imps Imports) ByPackageName(packageName string) *Import

type InfoNode

type InfoNode struct {
	Node ast.Node
}

type Method

type Method struct {
	Name    string
	Raw     *ast.Field
	RawCall *ast.FuncType
}

type Node

type Node struct {
	Raw    ast.Node
	Parent ast.Node
}

type Project

type Project struct {
	Imports Imports
	Package *Import
}

func ProjectByDir

func ProjectByDir(location string, limit int) (*Project, error)

func ProjectByPackage

func ProjectByPackage(packageImport string, limit int) (*Project, error)

func (*Project) FindLocalSymbol

func (prj *Project) FindLocalSymbol(name string) (*Symbol, error)

Find symbol defined only in the package

func (*Project) FindPackageImport

func (prj *Project) FindPackageImport(packageNameOrAlias string, file *File) (*Import, error)

func (*Project) FindSymbol

func (prj *Project) FindSymbol(qualifiedName string, sourceFile *File) (*Symbol, error)

func (*Project) Names

func (prj *Project) Names() []string

type Resolver

type Resolver interface {
	FindSymbol(qualifiedName string, sourceFile *File) (*Symbol, error)
}

type Symbol

type Symbol struct {
	Import     *Import
	File       *File
	Node       ast.Node
	ParentNode ast.Node
	Name       string
	BuiltIn    bool
}

func (*Symbol) ArrayItem

func (sym *Symbol) ArrayItem(resolver Resolver) *Symbol

func (*Symbol) Equal

func (sym *Symbol) Equal(b *Symbol) bool

func (*Symbol) Fields

func (sym *Symbol) Fields(resolver Resolver) ([]*Field, error)

func (*Symbol) FieldsNames

func (sym *Symbol) FieldsNames() ([]string, error)

func (*Symbol) Function

func (sym *Symbol) Function() (*Function, error)

func (*Symbol) Is

func (sym *Symbol) Is(importPath string, typeName string) bool

func (*Symbol) IsArray

func (sym *Symbol) IsArray() bool

func (*Symbol) IsCall

func (sym *Symbol) IsCall() bool

func (*Symbol) IsConstant

func (sym *Symbol) IsConstant() bool

func (*Symbol) IsFunction

func (sym *Symbol) IsFunction() bool

func (*Symbol) IsInterface

func (sym *Symbol) IsInterface() bool

func (*Symbol) IsLiteral

func (sym *Symbol) IsLiteral() bool

func (*Symbol) IsMap

func (sym *Symbol) IsMap() bool

func (*Symbol) IsPointer

func (sym *Symbol) IsPointer() bool

func (*Symbol) IsStruct

func (sym *Symbol) IsStruct() bool

func (*Symbol) IsStructDefinition

func (sym *Symbol) IsStructDefinition() bool

func (*Symbol) IsType

func (sym *Symbol) IsType() bool

func (*Symbol) IsVariable

func (sym *Symbol) IsVariable() bool

func (*Symbol) Literal

func (sym *Symbol) Literal() (string, error)

func (*Symbol) Methods

func (sym *Symbol) Methods(resolver Resolver) ([]*Method, error)

func (*Symbol) String

func (sym *Symbol) String() string

func (*Symbol) VarType

func (sym *Symbol) VarType() (*Symbol, error)

func (*Symbol) WithNode

func (sym *Symbol) WithNode(node ast.Node) *Symbol

type Type

type Type struct {
	Location string
	Import   string
	Name     string
	Ast      ast.Expr
}

Directories

Path Synopsis
cmd
Mutate structs and interfaces
Mutate structs and interfaces

Jump to

Keyboard shortcuts

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