types

package
v0.0.0-...-563a209 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 16, 2016 License: LGPL-3.0 Imports: 1 Imported by: 4

Documentation

Index

Constants

View Source
const (
	MaxIntWidth    = (1 << 31) - 1
	MaxArrayLength = MaxIntWidth
)

Variables

This section is empty.

Functions

func IsFirstClass

func IsFirstClass(t Type) bool

Types

type Array

type Array struct {
	// contains filtered or unexported fields
}

Array represents the type of an aggregate of a type, arranges sequentially in memory.

func NewArray

func NewArray(element Type, length int) *Array

func (Array) Element

func (v Array) Element() Type

func (Array) Equals

func (v Array) Equals(t Type) bool

func (Array) Length

func (v Array) Length() int

func (Array) String

func (v Array) String() string

type Float

type Float struct {
	// contains filtered or unexported fields
}

func NewFloat

func NewFloat(width FloatType) *Float

func (Float) Equals

func (v Float) Equals(t Type) bool

func (Float) String

func (v Float) String() string

func (Float) Type

func (v Float) Type() FloatType

type FloatType

type FloatType int
const (
	// IEEE 754
	Float32 FloatType = iota
	Float64
)

func (FloatType) CanExtendTo

func (v FloatType) CanExtendTo(w FloatType) bool

func (FloatType) CanTruncateTo

func (v FloatType) CanTruncateTo(w FloatType) bool

func (FloatType) Width

func (v FloatType) Width() int

Width returns the width of the float type in bits.

type Int

type Int struct {
	// contains filtered or unexported fields
}

Int represents an arbitrary-width integer. Int holds no sign information. Note that not all backends support all widths.

func NewInt

func NewInt(width int) *Int

Int returns a new Int with the specified width. Panics if the width is greater than MaxIntSize.

func (Int) Equals

func (v Int) Equals(t Type) bool

func (Int) String

func (v Int) String() string

func (Int) Width

func (v Int) Width() int

type Label

type Label struct{}

Label represents the type of a block.

func NewLabel

func NewLabel() *Label

func (Label) Equals

func (v Label) Equals(t Type) bool

func (Label) String

func (_ Label) String() string

type Pointer

type Pointer struct {
	// contains filtered or unexported fields
}

Pointer represents the type of a pointer to another type.

func NewPointer

func NewPointer(element Type) *Pointer

element cannot be an instance of Void

func (Pointer) Element

func (v Pointer) Element() Type

func (Pointer) Equals

func (v Pointer) Equals(t Type) bool

func (Pointer) String

func (v Pointer) String() string

type Signature

type Signature struct {
	// contains filtered or unexported fields
}

Signature represents a function signature.

func NewSignature

func NewSignature(parameters []Type, returnType Type, variadic bool) *Signature

NewSignature returns a signature with the specified parameter and return types. Panics if and supplied types are nil.

func (Signature) Equals

func (v Signature) Equals(t Type) bool

func (Signature) Parameters

func (v Signature) Parameters() TypeList

func (Signature) ReturnType

func (v Signature) ReturnType() Type

func (Signature) String

func (v Signature) String() string

func (Signature) Variadic

func (v Signature) Variadic() bool

type Struct

type Struct struct {
	// contains filtered or unexported fields
}

func NewStruct

func NewStruct(fields []Type, packed bool) *Struct

func (Struct) Equals

func (v Struct) Equals(t Type) bool

func (Struct) Fields

func (v Struct) Fields() TypeList

func (Struct) Packed

func (v Struct) Packed() bool

func (Struct) String

func (v Struct) String() string

type Type

type Type interface {
	String() string
	Equals(Type) bool
}

type TypeList

type TypeList []Type

func (TypeList) Equals

func (v TypeList) Equals(t TypeList) bool

type Void

type Void struct{}

Void represents the type associated with no value.

func NewVoid

func NewVoid() Void

func (Void) Equals

func (v Void) Equals(t Type) bool

func (Void) String

func (_ Void) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL