Accessor parsing; Cleanup

This commit is contained in:
dcodeIO
2017-12-14 11:55:35 +01:00
parent 99b0fdf7a8
commit c6c36613e6
30 changed files with 171 additions and 124 deletions

2
std/assembly.d.ts vendored
View File

@ -89,7 +89,7 @@ declare function isNaN<T = f32 | f64>(value: T): bool;
/** Tests if a 32-bit or 64-bit float is finite, that is not NaN or +/-Infinity. */
declare function isFinite<T = f32 | f64>(value: T): bool;
/** Traps if the specified value evaluates to `false`. */
declare function assert(isTrue: bool): void;
declare function assert(isTrue: bool, message?: string): void;
/** Parses an integer string to a 64-bit float. */
declare function parseInt(str: string, radix?: i32): f64;
/** Parses a string to a 64-bit float. */

View File

@ -2,6 +2,7 @@
"extends": "../tsconfig-base.json",
"compilerOptions": {
"target": "esnext",
"module": "commonjs",
"noLib": true,
"types": [],
"rootDirs": [

2
std/portable.d.ts vendored
View File

@ -51,7 +51,7 @@ declare function unreachable(): any; // sic
/** Changes the type of a value to another one. Useful for casting class instances to their pointer values and vice-versa. */
declare function changetype<T1,T2>(value: T1): T2;
/** Traps if the specified value evaluates to `false`. */
declare function assert(isTrue: bool): void;
declare function assert(isTrue: bool, message?: string): void;
/** Parses an integer string to a 64-bit float. */
declare function parseInt(str: string, radix?: i32): f64;
/** Parses a floating point string to a 64-bit float. */

View File

@ -19,14 +19,14 @@ UnreachableError.prototype.message = "unreachable";
globalScope["unreachable"] = function unreachable() { throw new UnreachableError(); };
function AssertionError() {
function AssertionError(message) {
this.message = message || "assertion failed";
this.stack = new Error().stack;
}
AssertionError.prototype = new Error;
AssertionError.prototype.name = "AssertionError";
AssertionError.prototype.message = "assertion failed";
globalScope["assert"] = function assert(isTrue) { if (!isTrue) throw new AssertionError(); };
globalScope["assert"] = function assert(isTrue, message) { if (!isTrue) throw new AssertionError(message); };
globalScope["changetype"] = function changetype(value) { return value; }
String["fromCharCodes"] = function fromCharCodes(arr) { return String.fromCharCode.apply(String, arr); }