Documentation ¶
Index ¶
- func MustReadGoString(r *kmgGoReader.Reader) (output []byte)
- func MustWriteGoTypes(thisPackagePath string, typi Type) (s string, addPkgPathList []string)
- type ArrayType
- type BuiltinType
- type ChanDir
- type ChanType
- type File
- type FuncOrMethodDeclaration
- type FuncParameter
- type FuncType
- type InterfaceType
- type Kind
- type MapType
- type NamedType
- type Package
- type PointerType
- type Program
- type SliceType
- type StringType
- type StructField
- type StructType
- type Type
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MustReadGoString ¶
func MustReadGoString(r *kmgGoReader.Reader) (output []byte)
可以读这两种 "abc" `abc` ,返回这个东西实际存放的信息.
Types ¶
type BuiltinType ¶
type BuiltinType string
内置的,没有package前缀的类型.
func (BuiltinType) GetKind ¶
func (t BuiltinType) GetKind() Kind
func (BuiltinType) String ¶
func (t BuiltinType) String() string
type File ¶
type File struct { PackageName string //最开头的package上面写的东西. PackagePath string ImportMap map[string]bool //这个文件的导入表 AliasImportMap map[string]string FuncList []*FuncOrMethodDeclaration MethodList []*FuncOrMethodDeclaration NamedTypeList []*NamedType Pkg *Package }
表示一个go的file
type FuncOrMethodDeclaration ¶
type FuncOrMethodDeclaration struct { Name string ReceiverType Type InParameter []FuncParameter OutParameter []FuncParameter }
func (*FuncOrMethodDeclaration) GetKind ¶
func (t *FuncOrMethodDeclaration) GetKind() Kind
func (*FuncOrMethodDeclaration) IsExport ¶
func (t *FuncOrMethodDeclaration) IsExport() bool
type FuncParameter ¶
type FuncType ¶
type FuncType struct { InParameter []FuncParameter OutParameter []FuncParameter }
TODO finish it.
type InterfaceType ¶
type InterfaceType struct { }
func (InterfaceType) GetKind ¶
func (t InterfaceType) GetKind() Kind
type NamedType ¶
type NamedType struct { PackagePath string Name string Pkg *Package // contains filtered or unexported fields }
func (*NamedType) GetUnderType ¶
type Package ¶
type Package struct { Program *Program PkgPath string ImportMap map[string]bool //这个package第一层import FuncList []*FuncOrMethodDeclaration MethodList []*FuncOrMethodDeclaration NamedTypeList []*NamedType }
表示一个package,注意: 一个目录下最多会有2个package.暂时忽略xxx_test 这种package
func MustParsePackage ¶
暂时忽略任何测试包. 此处不做编译检查,认为所有输入的go文件都是正常的.
func (*Package) GetImportList ¶
func (*Package) GetNamedTypeMethodSet ¶
func (pkg *Package) GetNamedTypeMethodSet(typ *NamedType) (output []*FuncOrMethodDeclaration)
func (*Package) LookupNamedType ¶
type PointerType ¶
type PointerType struct {
Elem Type
}
func NewPointer ¶
func NewPointer(elem Type) PointerType
func (PointerType) GetKind ¶
func (t PointerType) GetKind() Kind
type Program ¶
type Program struct { PackageLookupPathList []string // GOPATH, GOROOT CachedPackageMap map[string]*Package // pkgPath // contains filtered or unexported fields }
表示整个程序
func NewProgram ¶
func NewProgramFromDefault ¶
func NewProgramFromDefault() *Program
func (*Program) GetNamedType ¶
func (*Program) GetPackage ¶
type StringType ¶
type StringType struct { }
type StructField ¶
type StructType ¶
type StructType struct {
Field []StructField
}
TODO finish it
func (StructType) GetKind ¶
func (t StructType) GetKind() Kind
Source Files ¶
Click to show internal directories.
Click to hide internal directories.