Add showcase compiler test incl. respective features and fixes

This commit is contained in:
dcodeIO
2018-01-05 18:19:32 +01:00
parent 2d0f5f3087
commit 9846f6c033
15 changed files with 15362 additions and 88 deletions

View File

@ -46,14 +46,12 @@ export class CArray<T> {
private constructor() {}
@operator("[]")
get(index: i32): T {
assert(index >= 0);
return load<T>(index * sizeof<T>());
get(index: usize): T {
return load<T>(changetype<usize>(this) + index * sizeof<T>());
}
@operator("[]=")
set(index: i32, value: T): void {
assert(index >= 0);
store<T>(index * sizeof<T>(), value);
set(index: usize, value: T): void {
store<T>(changetype<usize>(this) + index * sizeof<T>(), value);
}
}