Program elements and resolve infrastructure; Stdlib ideas; Restructuring

This commit is contained in:
dcodeIO
2017-10-19 18:55:27 +02:00
parent 6e98c52f76
commit d1c1178f25
28 changed files with 1474 additions and 683 deletions

17
std/array.ts Normal file
View File

@ -0,0 +1,17 @@
/// <reference path="../assembly.d.ts" />
@global()
class Array<T> {
length: i32;
readonly capacity: i32;
readonly data: usize;
constructor(capacity: i32) {
if (capacity < 0)
throw new RangeError("capacity out of bounds");
this.length = capacity;
this.capacity = capacity;
this.data = Memory.allocate(sizeof<T>() * capacity);
}
}