Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConstValue ¶
type ConstValue struct {
// The constant's identifier.
Name string
// The value of the constant.
Value string
// The position of the constant's declaration in the source code.
Pos Position
// The raw documentation of the constant.
Doc []string
}
ConstValue represents a typed constant.
type Kind ¶
type Kind uint
Kind indicates the specific kind of a Go type.
const ( // basic KindInvalid Kind = iota KindBool KindInt KindInt8 KindInt16 KindInt32 KindInt64 KindUint KindUint8 KindUint16 KindUint32 KindUint64 KindUintptr KindFloat32 KindFloat64 KindComplex64 KindComplex128 KindString KindUnsafePointer // non-basic KindArray KindInterface KindMap KindPtr // 24 KindSlice KindStruct // not supported KindChan KindFunc // alisases (basic) KindByte = KindUint8 KindRune = KindInt32 )
func (Kind) IsArrayOrSlice ¶ added in v0.3.3
IsArrayOrSlice indicates whether or not k is an Array kind or a Slice kind.
type Position ¶
type Position struct {
// The name of the file in the token is declared.
Filename string `cmp:"+"`
// The line at which the token is declared in the file.
Line int `cmp:"+"`
}
The position of a token in the source code.
type Source ¶
type Source struct {
// contains filtered or unexported fields
}
not safe for concurrency
func (*Source) TypeDeclOf ¶
type StructField ¶
type StructField struct {
// Name of the field.
Name string
// The field's type.
Type *Type
// The field's raw tag.
Tag string
// Indicates whether or not the field is embedded.
IsEmbedded bool
// Indicates whether or not the field is exported.
IsExported bool
// The position of the field's declaration in the source code.
Pos Position
// The raw documentation of a struct field.
Doc []string
}
StructField describes a single struct field.
type Type ¶
type Type struct {
// The position of the type's declaration in the source code.
Pos Position
// The raw documentation of a named type.
Doc []string
// The name of a named type or empty string for unnamed types
Name string
// The kind of the go type.
Kind Kind
// The package import path.
PkgPath string
// Indicates whether or not the type is the "byte" alias type.
IsByte bool
// Indicates whether or not the type is the "rune" alias type.
IsRune bool
// If the base type's an array type, this field will hold the array's length.
ArrayLen int
// If kind is map, key will hold the info on the map's key type.
Key *Type
// If kind is map, elem will hold the info on the map's value type.
// If kind is ptr, elem will hold the info on pointed-to type.
// If kind is slice/array, elem will hold the info on slice/array element type.
// If kind is interface and the analyzed value was valid, elem will hold
// the info on the dynamic type.
Elem *Type
// If kind is struct, Fields will hold the list of the struct's fields.
Fields []*StructField
// If Type is a basic, defined type then Values will hold the list of
// declared constants of that type, if any.
Values []*ConstValue
// NOTE: Set only for types of the struct kind.
ReflectType reflect.Type
// contains filtered or unexported fields
}
Type is the representation of a Go type.
func (*Type) CanSelectFields ¶
CanSelectFields reports whether a value of Type t can be used in a field selector expression.
func (*Type) ElemHasConstValues ¶ added in v0.3.3
ElemHasConstValues reports whether the t's Elem type has associated const values.
func (*Type) HasConstValues ¶ added in v0.3.3
HasConstValues reports whether the t has associated const values.
type TypeDecl ¶
type TypeDecl struct {
// The position of a type's declaration in the source code.
Pos Position
// The raw documentation of the type.
Doc []string
// The declared type's name
Name string
// The type's package import path
PkgPath string
}
TypeDecl holds basic info on a declared Go type.
Click to show internal directories.
Click to hide internal directories.