Versions in this module Expand all Collapse all v1 v1.0.1 Jul 26, 2022 v1.0.0 Jan 5, 2021 Changes in this version + var Universe = NewScope() + var UniverseScope = ast.NewScope(nil) + func ExprToString(expr ast.Expr) string + func GetTypeStars(t Type) int + func InspectUnderlyingStruct(t Type, inspect func(*Field) bool) bool + func IsAtomicType(t Type) bool + func IsErrorType(t Type) bool + func NotNilPointerValue(t *PointerType, file *File) ast.Expr + func ParseExpr(x string) (ast.Expr, error) + func ResolveUnknownField(field *Field) + func TypeAssignable(target, source Type) bool + func TypeEqual(a, b Type) bool + func TypeEqualAsReceiver(t1 Type, t2 Type) bool + func TypeExprInFile(t Type, file *File) ast.Expr + func TypeInitValue(t Type, file *File) ast.Expr + func TypeIsUnknown(t Type) bool + func TypeZeroValue(t Type, file *File) ast.Expr + func WalkFile(file *File, walker DeclWalker) + func WalkPackage(pkg *Package, walker DeclWalker) + type ArrayType struct + Element Type + Len int + Slices int + func (t *ArrayType) AssignableTo(tt Type) bool + func (t *ArrayType) Copy() Type + func (t *ArrayType) DefaultValue() ast.Expr + func (t *ArrayType) EqualTo(tt Type) bool + func (t *ArrayType) File() *File + func (t *ArrayType) LenExpr() ast.Expr + func (t *ArrayType) Name() string + func (t *ArrayType) Package() *Package + func (t *ArrayType) String() string + func (t *ArrayType) Underlying() Type + type BasicType struct + func (t *BasicType) AssignableTo(Type) bool + func (t *BasicType) Copy() Type + func (t *BasicType) DefaultValue() ast.Expr + func (t *BasicType) EqualTo(tt Type) bool + func (t *BasicType) File() *File + func (t *BasicType) Name() string + func (t *BasicType) Package() *Package + func (t *BasicType) String() string + func (t *BasicType) Underlying() Type + type DeclFinder interface + Find func(ast.Decl) *DeclNode + WithName func(name string) DeclFinder + func NewFuncDeclFinder(recvName string) DeclFinder + func NewGenDeclFinder(tok token.Token) DeclFinder + func NewInterfaceTypeFinder() DeclFinder + func NewStructTypeFinder() DeclFinder + func NewTypeSpecFinder() DeclFinder + func NewValueSpecFinder() DeclFinder + type DeclNode struct + Alias ast.Expr + File *File + Name *ast.Ident + Node ast.Node + PreNode *DeclNode + func (node *DeclNode) InFile(f *File) *DeclNode + func (node *DeclNode) WithPre(dn *DeclNode) *DeclNode + type DeclWalker interface + Walk func(ast.Decl) bool + func NewFuncDeclWalker(walk func(*ast.FuncDecl) bool) DeclWalker + func NewGenDeclWalker(tok token.Token, walk func(*ast.GenDecl) bool) DeclWalker + type Direction int + const D_AddBracket + const D_AddPointer + const D_CallFunction + const D_Self + const D_SkipBracket + const D_SkipPointer + const D_SpreadFields + const D_TypeConversion + type Field struct + Tag string + func NewField(t Type, name string, tag string) *Field + func (t *Field) Copy() Type + func (t *Field) FieldName() string + func (t *Field) IsAnonymous() bool + func (t *Field) IsStruct() bool + func (t *Field) Name() string + func (t *Field) SetName(name string) + func (t *Field) SetType(tt Type) + func (t *Field) String() string + type File struct + BelongTo *Package + File *ast.File + Name string + func (f *File) FindAllDotImport() (paths []string) + func (f *File) FindImportPath(name string) (path string, ok bool) + func (f *File) ImportAllDots() []*Package + func (file *File) AddImport(name string, pkg *Package) + func (file *File) DotImported() []*Package + func (file *File) FindDecl(expr ast.Expr, finder DeclFinder) *DeclNode + func (file *File) FindImport(name string) *Package + func (file *File) FindImportNameByPath(path string) string + func (file *File) LookupImport(name string) (*File, *ast.Object) + func (file *File) LookupMethod(name string) ([]*File, []*ast.FuncDecl) + func (file *File) LookupName(name string) (*File, *ast.Object) + func (file *File) ReduceType(expr ast.Expr) Type + func (file *File) ReduceTypeSrc(src string) Type + type FuncDeclFinder struct + Name string + Receiver string + func (finder *FuncDeclFinder) Find(decl ast.Decl) *DeclNode + func (finder *FuncDeclFinder) WithName(name string) DeclFinder + type FuncDeclWalker struct + func (walker *FuncDeclWalker) Walk(decl ast.Decl) bool + type FuncType struct + Params []*Field + Receiver *Field + Results []*Field + func (*FuncType) Name() string + func (t *FuncType) AssignableTo(Type) bool + func (t *FuncType) Copy() Type + func (t *FuncType) DefaultValue() ast.Expr + func (t *FuncType) EqualTo(Type) bool + func (t *FuncType) File() *File + func (t *FuncType) Package() *Package + func (t *FuncType) String() string + func (t *FuncType) Underlying() Type + type GenDeclFinder struct + Tok token.Token + func (finder *GenDeclFinder) Find(decl ast.Decl) *DeclNode + func (finder *GenDeclFinder) WithName(name string) DeclFinder + type GenDeclWalker struct + Tok token.Token + func (walker *GenDeclWalker) Walk(decl ast.Decl) bool + type InterfaceType struct + Methods []*Field + func (t *InterfaceType) AssignableTo(tt Type) bool + func (t *InterfaceType) Copy() Type + func (t *InterfaceType) DefaultValue() ast.Expr + func (t *InterfaceType) EqualTo(tt Type) bool + func (t *InterfaceType) File() *File + func (t *InterfaceType) GetFuncByName(name string) Type + func (t *InterfaceType) Name() string + func (t *InterfaceType) Package() *Package + func (t *InterfaceType) String() string + func (t *InterfaceType) Underlying() Type + type InterfaceTypeFinder struct + func (finder *InterfaceTypeFinder) Find(decl ast.Decl) *DeclNode + func (finder *InterfaceTypeFinder) WithName(name string) DeclFinder + type OldFuncType struct + Expr ast.Expr + Name *ast.Ident + OldFuncType *ast.FuncType + Package *Package + Signature string + func NewOldFuncType(name string) *OldFuncType + func (ft *OldFuncType) CopyAstOldFuncType() *ast.FuncType + func (ft *OldFuncType) CopyAstOldFuncTypeToPackage(pkg *Package) *ast.FuncType + func (ft *OldFuncType) Fill(node *DeclNode) + type OldInterface struct + OldFuncTypes []*OldFuncType + func NewOldInterface() *OldInterface + func (i *OldInterface) Fill(node *DeclNode) + func (i *OldInterface) GetFuncByName(name string) *OldFuncType + type Package struct + CanonicalPath string + Dir string + Files []*File + Name string + PackageName string + Path string + Scope *Scope + func NewPackage(p *Parser, name string, dir string, path string, files []*File) *Package + func (pkg *Package) EqualTo(np *Package) bool + func (pkg *Package) FindDecl(name string, finder DeclFinder) *DeclNode + func (pkg *Package) FindFuncDecl(name string) *DeclNode + func (pkg *Package) GetFile(name string) *File + func (pkg *Package) InsertFile(file *File, index int) + func (pkg *Package) ReduceType(expr ast.Expr) (*File, Type) + type Parser struct + FileSet *token.FileSet + ImportContext build.Context + Scope *ast.Scope + Scopes map[string]*Scope + func NewParser() *Parser + func (p *Parser) AddScope(canonicalPath string, scope *Scope) + func (p *Parser) ImportPackage(name string, path string, srcDir string) *Package + func (p *Parser) ImportScope(path string, dir string) (canonicalPath string, scope *Scope) + func (p *Parser) InsertFileToPackage(pkg *Package, file *File, index int) + func (p *Parser) ParseFileContent(name string, content interface{}) *File + func (p *Parser) ParsePackage(path string, directory string, names []string) *Package + func (p *Parser) ParsePackageDir(directory string) *Package + func (p *Parser) ParsePackageFiles(names []string) *Package + func (p *Parser) PrintNode(node ast.Node) + type PointerType struct + Base Type + Stars int + func (t *PointerType) AssignableTo(tt Type) bool + func (t *PointerType) BaseType() Type + func (t *PointerType) Copy() Type + func (t *PointerType) DefaultValue() ast.Expr + func (t *PointerType) EqualTo(tt Type) bool + func (t *PointerType) File() *File + func (t *PointerType) Name() string + func (t *PointerType) Package() *Package + func (t *PointerType) String() string + func (t *PointerType) Underlying() Type + type Scope struct + Objects map[string]Type + func NewScope() *Scope + func (s *Scope) DeclType(name string, t Type) + func (s *Scope) Lookup(name string) Type + type StructType struct + Fields []*Field + func (t *StructType) AssignableTo(tt Type) bool + func (t *StructType) Copy() Type + func (t *StructType) DefaultValue() ast.Expr + func (t *StructType) EqualTo(tt Type) bool + func (t *StructType) File() *File + func (t *StructType) Name() string + func (t *StructType) Package() *Package + func (t *StructType) String() string + func (t *StructType) Underlying() Type + type StructTypeFinder struct + func (finder *StructTypeFinder) Find(decl ast.Decl) *DeclNode + func (finder *StructTypeFinder) WithName(name string) DeclFinder + type TPath struct + Arg interface{} + D Direction + Source Type + Target Type + func NewTPath(src Type, dst Type) *TPath + func TypeToType(a Type, b Type, knowns []*TPath) ([]*TPath, bool) + func (tp *TPath) ConflictWith(ot *TPath) bool + func (tp *TPath) Copy() *TPath + func (tp *TPath) String() string + func (tp *TPath) WithArg(arg interface{}) *TPath + func (tp *TPath) WithDirection(d Direction) *TPath + func (tp *TPath) WithFunction(funcType Type) *TPath + func (tp *TPath) WithTypeConversion(t Type) *TPath + type Type interface + AssignableTo func(Type) bool + Copy func() Type + EqualTo func(Type) bool + File func() *File + Name func() string + Package func() *Package + String func() string + Underlying func() Type + func ErrorType() Type + func GetInterfaceFuncByName(t Type, name string) Type + func MapType(key Type, val Type) Type + func NewBasicType(name string) Type + func NewType(name string) Type + func ParseType(node ast.Node) Type + func ParseTypeString(str string) Type + func TypeSkipBracket(t Type, n int) Type + func TypeSkipPointer(t Type, n int) Type + func TypeWithArray(t Type, len int) Type + func TypeWithExpr(t Type, expr ast.Expr) Type + func TypeWithFile(t Type, file *File) Type + func TypeWithName(underlying Type, name string) Type + func TypeWithPointer(t Type) Type + func TypeWithSlice(t Type) Type + func TypeWrapStruct(t Type, name string) Type + type TypeSpecFinder struct + Name string + func (finder *TypeSpecFinder) Find(decl ast.Decl) *DeclNode + func (finder *TypeSpecFinder) WithName(name string) DeclFinder + type UnknownType struct + Parent Type + func NewUnknownType(file *File, expr ast.Expr) *UnknownType + func TypeHasUnknown(t Type) (*UnknownType, bool) + func (t *UnknownType) AssignableTo(Type) bool + func (t *UnknownType) Copy() Type + func (t *UnknownType) DefaultValue() ast.Expr + func (t *UnknownType) EqualTo(Type) bool + func (t *UnknownType) File() *File + func (t *UnknownType) Name() string + func (t *UnknownType) Package() *Package + func (t *UnknownType) String() string + func (t *UnknownType) Underlying() Type + func (t *UnknownType) WithFile(f *File) *UnknownType + func (unknown *UnknownType) Reduce(file *File) Type + func (unknown *UnknownType) ResetParent(kn Type) + type ValueSpecFinder struct + Name string + func (finder *ValueSpecFinder) Find(decl ast.Decl) *DeclNode + func (finder *ValueSpecFinder) WithName(name string) DeclFinder