Documentation ¶
Index ¶
- Variables
- type ArrayType
- func (t *ArrayType) Compat(o vm.Type, conv bool) bool
- func (t *ArrayType) IsBoolean() bool
- func (t *ArrayType) IsFloat() bool
- func (t *ArrayType) IsIdeal() bool
- func (t *ArrayType) IsInteger() bool
- func (t *ArrayType) Lit() vm.Type
- func (t *ArrayType) String() string
- func (t *ArrayType) Zero() vm.Value
- type BoolType
- type ChanType
- type ComplexType
- func (t *ComplexType) Compat(o vm.Type, conv bool) bool
- func (t *ComplexType) IsBoolean() bool
- func (t *ComplexType) IsFloat() bool
- func (t *ComplexType) IsIdeal() bool
- func (t *ComplexType) IsInteger() bool
- func (t *ComplexType) Lit() vm.Type
- func (t *ComplexType) String() string
- func (t *ComplexType) Zero() vm.Value
- type FloatType
- func (t *FloatType) Compat(o vm.Type, conv bool) bool
- func (t *FloatType) IsBoolean() bool
- func (t *FloatType) IsFloat() bool
- func (t *FloatType) IsIdeal() bool
- func (t *FloatType) IsInteger() bool
- func (t *FloatType) Lit() vm.Type
- func (t *FloatType) MaxVal() *big.Rat
- func (t *FloatType) MinVal() *big.Rat
- func (t *FloatType) String() string
- func (t *FloatType) Zero() vm.Value
- type FuncDecl
- type FuncType
- type IdealFloatType
- func (t *IdealFloatType) Compat(o vm.Type, conv bool) bool
- func (t *IdealFloatType) IsBoolean() bool
- func (t *IdealFloatType) IsFloat() bool
- func (t *IdealFloatType) IsIdeal() bool
- func (t *IdealFloatType) IsInteger() bool
- func (t *IdealFloatType) Lit() vm.Type
- func (t *IdealFloatType) String() string
- func (t *IdealFloatType) Zero() vm.Value
- type IdealIntType
- func (t *IdealIntType) Compat(o vm.Type, conv bool) bool
- func (t *IdealIntType) IsBoolean() bool
- func (t *IdealIntType) IsFloat() bool
- func (t *IdealIntType) IsIdeal() bool
- func (t *IdealIntType) IsInteger() bool
- func (t *IdealIntType) Lit() vm.Type
- func (t *IdealIntType) String() string
- func (t *IdealIntType) Zero() vm.Value
- type IntType
- func (t *IntType) Compat(o vm.Type, conv bool) bool
- func (t *IntType) IsBoolean() bool
- func (t *IntType) IsFloat() bool
- func (t *IntType) IsIdeal() bool
- func (t *IntType) IsInteger() bool
- func (t *IntType) Lit() vm.Type
- func (t *IntType) MaxVal() *big.Rat
- func (t *IntType) MinVal() *big.Rat
- func (t *IntType) String() string
- func (t *IntType) Zero() vm.Value
- type InterfaceType
- func (t *InterfaceType) Compat(o vm.Type, conv bool) bool
- func (t *InterfaceType) IsBoolean() bool
- func (t *InterfaceType) IsFloat() bool
- func (t *InterfaceType) IsIdeal() bool
- func (t *InterfaceType) IsInteger() bool
- func (t *InterfaceType) Lit() vm.Type
- func (t *InterfaceType) String() string
- func (t *InterfaceType) Zero() vm.Value
- type MapType
- type Method
- type MultiType
- func (t *MultiType) Compat(o vm.Type, conv bool) bool
- func (t *MultiType) IsBoolean() bool
- func (t *MultiType) IsFloat() bool
- func (t *MultiType) IsIdeal() bool
- func (t *MultiType) IsInteger() bool
- func (t *MultiType) Lit() vm.Type
- func (t *MultiType) String() string
- func (t *MultiType) Zero() vm.Value
- type NamedType
- func (t *NamedType) Compat(o vm.Type, conv bool) bool
- func (t *NamedType) Complete(def vm.Type)
- func (t *NamedType) IsBoolean() bool
- func (t *NamedType) IsFloat() bool
- func (t *NamedType) IsIdeal() bool
- func (t *NamedType) IsInteger() bool
- func (t *NamedType) Lit() vm.Type
- func (t *NamedType) Pos() token.Pos
- func (t *NamedType) String() string
- func (t *NamedType) Zero() vm.Value
- type PackageField
- type PackageType
- func (p *PackageType) Compat(o vm.Type, conv bool) bool
- func (t *PackageType) IsBoolean() bool
- func (t *PackageType) IsFloat() bool
- func (t *PackageType) IsIdeal() bool
- func (t *PackageType) IsInteger() bool
- func (p *PackageType) Lit() vm.Type
- func (p *PackageType) String() string
- func (p *PackageType) Zero() vm.Value
- type PtrType
- type SliceType
- func (t *SliceType) Compat(o vm.Type, conv bool) bool
- func (t *SliceType) IsBoolean() bool
- func (t *SliceType) IsFloat() bool
- func (t *SliceType) IsIdeal() bool
- func (t *SliceType) IsInteger() bool
- func (t *SliceType) Lit() vm.Type
- func (t *SliceType) String() string
- func (t *SliceType) Zero() vm.Value
- type StringType
- func (t *StringType) Compat(o vm.Type, conv bool) bool
- func (t *StringType) IsBoolean() bool
- func (t *StringType) IsFloat() bool
- func (t *StringType) IsIdeal() bool
- func (t *StringType) IsInteger() bool
- func (t *StringType) Lit() vm.Type
- func (t *StringType) String() string
- func (t *StringType) Zero() vm.Value
- type StructField
- type StructType
- func (t *StructType) Compat(o vm.Type, conv bool) bool
- func (t *StructType) IsBoolean() bool
- func (t *StructType) IsFloat() bool
- func (t *StructType) IsIdeal() bool
- func (t *StructType) IsInteger() bool
- func (t *StructType) Lit() vm.Type
- func (t *StructType) String() string
- func (t *StructType) Zero() vm.Value
- type UintType
- func (t *UintType) Compat(o vm.Type, conv bool) bool
- func (t *UintType) IsBoolean() bool
- func (t *UintType) IsFloat() bool
- func (t *UintType) IsIdeal() bool
- func (t *UintType) IsInteger() bool
- func (t *UintType) Lit() vm.Type
- func (t *UintType) MaxVal() *big.Rat
- func (t *UintType) MinVal() *big.Rat
- func (t *UintType) String() string
- func (t *UintType) Zero() vm.Value
Constants ¶
This section is empty.
Variables ¶
var EmptyType vm.Type = NewMultiType([]vm.Type{})
Functions ¶
This section is empty.
Types ¶
type ArrayType ¶
type ArrayType struct { Len int64 // The length of the array Elem vm.Type // The type of the array elements // contains filtered or unexported fields }
ArrayType is used to represent array types (https://golang.org/ref/spec#Array_types).
func NewArrayType ¶
NewArrayType creates a new array type with the specified length and element type.
type BoolType ¶
type BoolType struct {
// contains filtered or unexported fields
}
BoolType is used to represent boolean types (https://golang.org/ref/spec#Boolean_types).
type ChanType ¶
type ChanType struct {
// contains filtered or unexported fields
}
ChanType is used to represent channel types (https://golang.org/ref/spec#Channel_types).
type ComplexType ¶
type ComplexType struct { Bits uint // 0 for architecture-dependent type // contains filtered or unexported fields }
ComplexType is used to represent complex numbers types (https://golang.org/ref/spec#Numeric_types).
func (*ComplexType) IsBoolean ¶
func (t *ComplexType) IsBoolean() bool
func (*ComplexType) IsFloat ¶
func (t *ComplexType) IsFloat() bool
func (*ComplexType) IsIdeal ¶
func (t *ComplexType) IsIdeal() bool
func (*ComplexType) IsInteger ¶
func (t *ComplexType) IsInteger() bool
func (*ComplexType) Lit ¶
func (t *ComplexType) Lit() vm.Type
func (*ComplexType) String ¶
func (t *ComplexType) String() string
func (*ComplexType) Zero ¶
func (t *ComplexType) Zero() vm.Value
type FloatType ¶
type FloatType struct { Bits uint // 0 for architecture-dependent type // contains filtered or unexported fields }
FloatType is used to represent floating-point number types (https://golang.org/ref/spec#Numeric_types).
func MakeFloatType ¶
MakeFloatType creates a new floating-point type of the specified bit size.
type FuncDecl ¶
type FuncType ¶
type FuncType struct { In []vm.Type Variadic bool Out []vm.Type Builtin string // contains filtered or unexported fields }
func NewFuncType ¶
NewFuncType creates a new function type with the specified input and output types.
type IdealFloatType ¶
type IdealFloatType struct {
// contains filtered or unexported fields
}
func (*IdealFloatType) Compat ¶
func (t *IdealFloatType) Compat(o vm.Type, conv bool) bool
Compat returns whether this type is compatible with another type.
func (*IdealFloatType) IsFloat ¶
func (t *IdealFloatType) IsFloat() bool
IsFloat returns true if this is a floating type.
func (*IdealFloatType) IsIdeal ¶
func (t *IdealFloatType) IsIdeal() bool
IsIdeal returns true if this represents an ideal value.
func (*IdealFloatType) Lit ¶
func (t *IdealFloatType) Lit() vm.Type
Lit returns this type's literal.
func (*IdealFloatType) String ¶
func (t *IdealFloatType) String() string
String returns the string representation of this type.
func (*IdealFloatType) Zero ¶
func (t *IdealFloatType) Zero() vm.Value
Zero returns a new zero value of this type.
type IdealIntType ¶
type IdealIntType struct {
// contains filtered or unexported fields
}
func (*IdealIntType) Compat ¶
func (t *IdealIntType) Compat(o vm.Type, conv bool) bool
Compat returns whether this type is compatible with another type.
func (*IdealIntType) IsIdeal ¶
func (t *IdealIntType) IsIdeal() bool
IsIdeal returns true if this represents an ideal value.
func (*IdealIntType) IsInteger ¶
func (t *IdealIntType) IsInteger() bool
IsInteger returns true if this is an integer type.
func (*IdealIntType) String ¶
func (t *IdealIntType) String() string
String returns the string representation of this type.
func (*IdealIntType) Zero ¶
func (t *IdealIntType) Zero() vm.Value
Zero returns a new zero value of this type.
type IntType ¶
type IntType struct { Bits uint // 0 for architecture-dependent types Name string // The name of the int type // contains filtered or unexported fields }
IntType is used to represent signed integer number types (https://golang.org/ref/spec#Numeric_types).
func MakeIntType ¶
MakeIntType creates a new integer type of the specified bit size.
type InterfaceType ¶
type InterfaceType struct { Methods map[string]*FuncType // contains filtered or unexported fields }
func NewInterfaceType ¶
func NewInterfaceType(methods map[string]*FuncType, embeds []*InterfaceType) *InterfaceType
NewInterfaceType creates a new interface type with the specified methods.
func (*InterfaceType) Lit ¶
func (t *InterfaceType) Lit() vm.Type
func (*InterfaceType) String ¶
func (t *InterfaceType) String() string
func (*InterfaceType) Zero ¶
func (t *InterfaceType) Zero() vm.Value
type MapType ¶
func NewMapType ¶
NewMapType creates a new map type of the specified type.
type MultiType ¶
MultiType is a special type used for multi-valued expressions, akin to a tuple type. It's not generally accessible within the language.
func NewMultiType ¶
type NamedType ¶
type NamedType struct { NTPos token.Pos Name string Def vm.Type // Underlying type. Incomplete bool // True while this type is being defined. Methods map[string]Method // }
NamedType represents a user defined type.
If Incomplete is true, Def will be nil. If Incomplete is false and Def is still nil, then this is a placeholder type representing an error.
type PackageField ¶
type PackageType ¶
type PackageType struct { Elems []PackageField // contains filtered or unexported fields }
func NewPackageType ¶
func NewPackageType(path string, fields []PackageField) *PackageType
NewPackageType creates a new package import type.
func (*PackageType) Compat ¶
func (p *PackageType) Compat(o vm.Type, conv bool) bool
Compat returns whether this type is compatible with another type.
func (*PackageType) String ¶
func (p *PackageType) String() string
String returns the string representation of this type.
func (*PackageType) Zero ¶
func (p *PackageType) Zero() vm.Value
Zero returns a new zero value of this type.
type PtrType ¶
func NewPtrType ¶
NewPtrType creates a new ptr type with the specified target type.
type SliceType ¶
func NewSliceType ¶
NewSliceType creates a new slice type with the specified element type.
type StringType ¶
type StringType struct {
// contains filtered or unexported fields
}
func (*StringType) Compat ¶
func (t *StringType) Compat(o vm.Type, conv bool) bool
Compat returns whether this type is compatible with another type.
func (*StringType) String ¶
func (t *StringType) String() string
String returns the string representation of this type.
func (*StringType) Zero ¶
func (t *StringType) Zero() vm.Value
Zero returns a new zero value of this type.
type StructType ¶
type StructType struct { Elems []StructField // contains filtered or unexported fields }
func NewStructType ¶
func NewStructType(fields []StructField) *StructType
NewStructType creates a new struct type with the specified fields.
func (*StructType) Compat ¶
func (t *StructType) Compat(o vm.Type, conv bool) bool
Compat returns whether this type is compatible with another type.
func (*StructType) String ¶
func (t *StructType) String() string
String returns the string representation of this type.
func (*StructType) Zero ¶
func (t *StructType) Zero() vm.Value
Zero returns a new zero value of this type.
type UintType ¶
type UintType struct { Bits uint // 0 for architecture-dependent types Ptr bool // true for uintptr, false for all others Name string // The name of the uint type // contains filtered or unexported fields }
UintType is used to represent unsigned integer number types (https://golang.org/ref/spec#Numeric_types).
func MakeUIntType ¶
MakeUIntType creates a new unsigned integer type of the specified bit size.