mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-06-15 16:01:30 +00:00
Comma expressions fwiw
This commit is contained in:
@ -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);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user