Fixes; Builtins; Testing in the interpreter

This commit is contained in:
dcodeIO
2017-12-03 23:04:33 +01:00
parent 032ae379cd
commit 017efc71b6
33 changed files with 791 additions and 68 deletions

17
std/impl/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);
}
}