Closed
Description
array.length manipulations allowed in JS/TS so I tried this
class Struct {
a:i32;
}
export function report(): i32 {
let res = 0;
let arr:Struct[] = [];
for(let i=0;i<10;i++) {
arr.push(new Struct());
}
arr.length = 0; // will throw here
return res;
}
It produces Uncaught Error: abort: Index out of range at ~lib/rt.ts:22:27
Also setting length to higher values should allocate more memory, but fill with 0 (because on array deallocation it would try free pointer to garbage)