mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-07 04:23:41 +00:00
compiler: implement make([]T, ...)
This commit is contained in:
@@ -99,10 +99,18 @@ func lookupBoundsCheck(length, index int) {
|
||||
}
|
||||
}
|
||||
|
||||
// Check for bounds in *ssa.Slice
|
||||
// Check for bounds in *ssa.Slice.
|
||||
func sliceBoundsCheck(length, low, high uint) {
|
||||
if !(0 <= low && low <= high && high <= length) {
|
||||
printstring("panic: runtime error: slice out of range\n")
|
||||
abort()
|
||||
}
|
||||
}
|
||||
|
||||
// Check for bounds in *ssa.MakeSlice.
|
||||
func sliceBoundsCheckMake(length, capacity uint) {
|
||||
if !(0 <= length && length <= capacity) {
|
||||
printstring("panic: runtime error: slice size out of range\n")
|
||||
abort()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user