mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-13 15:33:40 +00:00
compiler: add *ssa.MakeSlice bounds tests
There are some bugs in it. This commit adds the tests, so that the next commit can show what changed.
This commit is contained in:
committed by
Ron Evans
parent
59d53182bb
commit
a2cc5715ba
Vendored
+18
@@ -23,3 +23,21 @@ func sliceAppendSlice(ints, added []int) []int {
|
||||
func sliceCopy(dst, src []int) int {
|
||||
return copy(dst, src)
|
||||
}
|
||||
|
||||
// Test bounds checking in *ssa.MakeSlice instruction.
|
||||
|
||||
func makeByteSlice(len int) []byte {
|
||||
return make([]byte, len)
|
||||
}
|
||||
|
||||
func makeInt16Slice(len int) []int16 {
|
||||
return make([]int16, len)
|
||||
}
|
||||
|
||||
func makeArraySlice(len int) [][3]byte {
|
||||
return make([][3]byte, len) // slice with element size of 3
|
||||
}
|
||||
|
||||
func makeInt32Slice(len int) []int32 {
|
||||
return make([]int32, len)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user