-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Add support for arrays in Quickfall.
There are two types of arrays in Quickfall:
- Static arrays: arrays of fixed size, will represent an vector IR type. Can be defined as follows
<type>[<size as u64>] - Pointer-based arrays: arrays originating from a pointer. These are unsafe and will return unsafe marked values. Pointer arrays can also be passed as pointers. Written as
*<type>[]
Syntax examples
var si32[6] testArray // 0 initialized
var si32 myInt = testArray[4]; // Gets 0, bounds checked at compile time
var si64 ind = ......
var si32 myInt = testArray[ind]; // Will check bounds at runtime if runtime safety isnt disabled. Will trigger a warning if not.
var ptr myPointer = ..... // Get from the allocator
var *si32[] myArray = cast_ptr si32<myPointer> // Converts myPointer into an array pointer
var si32# myUnsafeInt = myArray[7];
var si32? mySafeInt = myUnsafeInt.as_true(); // Runtime checks
var si32 myForcedInt = myUnsafeInt.as_true_forced(); // No runtime checks
Reactions are currently unavailable