Comma expressions fwiw

This commit is contained in:
dcodeIO
2018-01-05 01:55:59 +01:00
parent 7e9b58428b
commit 2d0f5f3087
11 changed files with 764 additions and 152 deletions

View File

@ -38,3 +38,22 @@ export class Array<T> {
// TODO
}
@global
@struct
export class CArray<T> {
private constructor() {}
@operator("[]")
get(index: i32): T {
assert(index >= 0);
return load<T>(index * sizeof<T>());
}
@operator("[]=")
set(index: i32, value: T): void {
assert(index >= 0);
store<T>(index * sizeof<T>(), value);
}
}