typesutil

package
v1.2.6 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewTypeAndValueForCallResult added in v1.1.12

func NewTypeAndValueForCallResult(typ types.Type, val constant.Value) (ret types.TypeAndValue)

func NewTypeAndValueForObject added in v1.1.12

func NewTypeAndValueForObject(obj types.Object) (ret types.TypeAndValue)

func NewTypeAndValueForType added in v1.1.12

func NewTypeAndValueForType(typ types.Type) (ret types.TypeAndValue)

func NewTypeAndValueForValue added in v1.1.12

func NewTypeAndValueForValue(typ types.Type, val constant.Value, mode OperandMode) (ret types.TypeAndValue)

Types

type OperandMode added in v1.2.0

type OperandMode byte

An OperandMode specifies the (addressing) mode of an operand.

const (
	Invalid  OperandMode = iota // operand is invalid
	NoValue                     // operand represents no value (result of a function call w/o result)
	Builtin                     // operand is a built-in function
	TypExpr                     // operand is a type
	Constant                    // operand is a constant; the operand's typ is a Basic type
	Variable                    // operand is an addressable variable
	MapIndex                    // operand is a map index expression (acts like a variable on lhs, commaok on rhs of an assignment)
	Value                       // operand is a computed value
	CommaOK                     // like value, but operand may be used in a comma,ok expression
	CommaErr                    // like commaok, but second value is error, not boolean
	CgoFunc                     // operand is a cgo function
)

type TypeAndValue

type TypeAndValue struct {
	Type  types.Type
	Value constant.Value
	// contains filtered or unexported fields
}

TypeAndValue reports the type and value (for constants) of the corresponding expression.

Jump to

Keyboard shortcuts

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