Data Access
Fundamental operations on aggregates and enums. None may be overloaded.
primitiveCopy
[T]
primitiveCopy(dest:T, src:T) :;
Bitwise copies TypeSize(T) bytes from src into dest. Lowers to an LLVM load followed by store.
arrayRef
[T, n, I | Integer?(I)]
arrayRef(array:Array[T, n], i:I) : ref T;
Returns a reference to element i of array.
- Zero-based. Not bounds-checked.
- Lowers to LLVM
getelementptr.
arrayElements
[T, n]
arrayElements(array:Array[T, n]) : ref ..repeatValue(static n, T);
Returns a multiple-value list of references to every element of array in order.
tupleRef
[..T, n | n >= 0 and n < countValues(..T)]
tupleRef(tuple:Tuple[..T], static n) : ref nthValue(static n, ..T);
Returns a reference to the nth element of tuple.
- Zero-based.
nis checked at compile time. - Lowers to LLVM
getelementptr.
tupleElements
[..T]
tupleElements(tuple:Tuple[..T]) : ref ..T;
Returns a multiple-value list of references to every tuple element in order.
recordFieldRef
[R, n | Record?(R) and n >= 0 and n < RecordFieldCount(R)]
recordFieldRef(rec:R, static n) : ref RecordFieldType(R, static n);
Returns a reference to the nth field of a record value.
- Zero-based.
nis checked at compile time. - Lowers to LLVM
getelementptr.
recordFieldRefByName
[R, name | Record?(R) and Identifier?(name) and RecordWithField?(R, name)]
recordFieldRefByName(rec:R, static name) : ref RecordFieldTypeByName(R, name);
Returns a reference to the field named name (a static string) in rec.
recordFields
[R | Record?(R)]
recordFields(rec:R) : ref ..RecordFieldTypes(R);
Returns a multiple-value list of references to all fields of rec in declaration order.
enumToInt
[E | Enum?(E)]
enumToInt(en:E) : Int32;
Returns the ordinal of en as an Int32.
intToEnum
[E | Enum?(E)]
intToEnum(static E, n:Int32) : E;
Returns the value of enum type E with ordinal n. Not bounds-checked against the values defined for E.