Implicitly alias stdlib exports as program globals, see #8

This commit is contained in:
dcodeIO
2018-01-12 15:36:17 +01:00
parent 3980e53bb7
commit 2df318a7ec
27 changed files with 417 additions and 179 deletions

View File

@ -1,4 +1,3 @@
@global
export class Array<T> {
private ptr: usize;
@ -39,7 +38,6 @@ export class Array<T> {
// TODO
}
@global
@struct
export class CArray<T> {

View File

@ -1,4 +1,3 @@
@global
export class Error {
name: string = "Error";
@ -10,7 +9,6 @@ export class Error {
}
}
@global
export class RangeError extends Error {
name: string = "RangeError";
}

View File

@ -6,7 +6,6 @@ var HEAP_OFFSET: usize = HEAP_BASE; // HEAP_BASE is a constant generated by the
// TODO: maybe tlsf
@global
export class Heap {
static get used(): usize { return HEAP_OFFSET - HEAP_BASE; }

View File

@ -1,4 +1,3 @@
@global
export class Map<K,V> {
// TODO
}

View File

@ -1,5 +1,4 @@
@global
class RegExp {
export class RegExp {
// @binding(CALL_NEW, [ STRING, STRING], OBJECT_HANDLE)
constructor(pattern: string, flags: string = "") { throw new Error("unreachable"); }

View File

@ -1,4 +1,3 @@
@global
export class Set<T> {
// TODO
}

View File

@ -1,6 +1,5 @@
const EMPTY: String = changetype<String>("");
@global
export class String {
// [key: number]: string;
@ -197,13 +196,11 @@ function isWhiteSpaceOrLineTerminator(c: u16): bool {
}
}
// @global
// @binding(CALL, [ STRING, PASS_THRU ], PASS_THRU)
export function parseInt(str: string, radix: i32 = 10): f64 {
throw new Error("not implemented");
}
// @global
// @binding(CALL, [ STRING ], PASS_THRU)
export function parseFloat(str: string): f64 {
throw new Error("not implemented");