Documentation ¶
Index ¶
- Constants
- Variables
- func IsBuiltin(t Type) bool
- func IsBuiltinFuncString(t string) bool
- func IsBuiltinString(t string) bool
- func IsBuiltinTypeString(t string) bool
- func IsType(f func(Type) Type) func(Type) bool
- func TypeName(t Type) *string
- type Base
- type File
- type FileType
- type Function
- type Import
- type Interface
- type LinearType
- type Method
- type Struct
- type StructField
- type TArray
- type TChan
- type TEllipsis
- type TImport
- type TInterface
- type TMap
- type TName
- type TPointer
- type Type
- type Variable
Constants ¶
View Source
const ( ChanDirSend = 1 ChanDirRecv = 2 ChanDirAny = ChanDirSend | ChanDirRecv )
Variables ¶
View Source
var ( // Checks, is type contain array. IsArray = IsType(TypeArray) // Checks, is type contain map. IsMap = IsType(TypeMap) // Checks, is type contain interface. IsInterface = IsType(TypeInterface) IsEllipsis = IsType(TypeEllipsis) IsStruct = IsType(TypeStruct) IsFunction = IsType(TypeFunction) )
Checks, is type contain some type. Generic checkers.
View Source
var BuiltinFunctions = map[string]bool{ "append": true, "copy": true, "delete": true, "len": true, "cap": true, "make": true, "new": true, "complex": true, "real": true, "imag": true, "close": true, "panic": true, "recover": true, "print": true, "println": true, }
List of all builtin functions.
View Source
var BuiltinTypes = map[string]bool{ "bool": true, "uint8": true, "uint16": true, "uint32": true, "uint64": true, "int8": true, "int16": true, "int32": true, "int64": true, "float32": true, "float64": true, "complex64": true, "complex128": true, "string": true, "int": true, "uint": true, "uintptr": true, "byte": true, "rune": true, "error": true, }
List of all builtin types.
Functions ¶
func IsBuiltinFuncString ¶
func IsBuiltinString ¶
func IsBuiltinTypeString ¶
Types ¶
type Base ¶
type Base struct { Name string `json:"name,omitempty"` Docs []string `json:"docs,omitempty"` Comments []string `json:"comments,omitempty"` }
Base type for all (almost) entities. It contains name of entity and docs. Docs is a comments in golang syntax above entity declaration. Each block comment is counted as one.
type File ¶
type File struct { Base // `File.Name` is package name, `File.Docs` is a comments above `package ...` Imports []*Import `json:"imports,omitempty"` // Contains imports and their aliases from `import` blocks. Constants []Variable `json:"constants,omitempty"` // Contains constant variables from `const` blocks. Vars []Variable `json:"vars,omitempty"` // Contains variables from `var` blocks. Interfaces []Interface `json:"interfaces,omitempty"` // Contains `type Foo interface` declarations. Structures []Struct `json:"structures,omitempty"` // Contains `type Foo struct` declarations. Functions []Function `json:"functions,omitempty"` // Contains `func Foo() {}` declarations. Methods []Method `json:"methods,omitempty"` // Contains `func (a A) Foo(b B) (c C) {}` declarations. Types []FileType `json:"types,omitempty"` // Contains `type X int` declarations. }
File is a top-level entity, that contains all top-level declarations of the file.
func (File) HasPackage ¶
type Function ¶
type Interface ¶
type LinearType ¶
type LinearType interface {
NextType() Type
}
type Struct ¶
type Struct struct { Base Fields []StructField `json:"fields,omitempty"` Methods []*Method `json:"methods,omitempty"` }
type StructField ¶
type StructField struct { Variable Tags map[string][]string `json:"tags,omitempty"` RawTags string `json:"raw,omitempty"` // Raw string from source. }
func (StructField) String ¶
func (f StructField) String() string
type TArray ¶
type TEllipsis ¶
type TEllipsis struct {
Next Type `json:"next,omitempty"`
}
TEllipsis used only for function params in declarations like `strs ...string`
type TInterface ¶
type TInterface struct {
Interface *Interface `json:"interface,omitempty"`
}
func (TInterface) String ¶
func (i TInterface) String() string
type TPointer ¶
type Type ¶
type Type interface { String() string // contains filtered or unexported methods }
func TypeEllipsis ¶
func TypeFunction ¶ added in v1.1.0
func TypeInterface ¶
func TypeStruct ¶ added in v1.1.0
Click to show internal directories.
Click to hide internal directories.