mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-04-25 07:02:13 +00:00
Add ArrayBuffer/DataView/Symbol#toString and improve Errors (#332)
This commit is contained in:
parent
a79db87af9
commit
1928404f3b
@ -30,4 +30,8 @@ export class ArrayBuffer {
|
|||||||
memory.copy(changetype<usize>(buffer) + HEADER_SIZE, changetype<usize>(this) + HEADER_SIZE + begin, newLen);
|
memory.copy(changetype<usize>(buffer) + HEADER_SIZE, changetype<usize>(this) + HEADER_SIZE + begin, newLen);
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
toString(): string {
|
||||||
|
return "[object ArrayBuffer]";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -177,6 +177,10 @@ export class DataView {
|
|||||||
HEADER_SIZE
|
HEADER_SIZE
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
toString(): string {
|
||||||
|
return "[object DataView]";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@inline function checkOffset(byteOffset: i32, n: i32, byteLength: i32): void {
|
@inline function checkOffset(byteOffset: i32, n: i32, byteLength: i32): void {
|
||||||
|
@ -1,12 +1,11 @@
|
|||||||
export class Error {
|
export class Error {
|
||||||
|
|
||||||
name: string = "Error";
|
name: string = "Error";
|
||||||
message: string;
|
|
||||||
stack: string = ""; // TODO
|
stack: string = ""; // TODO
|
||||||
|
|
||||||
constructor(message: string = "") {
|
constructor(
|
||||||
this.message = message;
|
public message: string = ""
|
||||||
}
|
) {}
|
||||||
|
|
||||||
toString(): string {
|
toString(): string {
|
||||||
var message = this.message;
|
var message = this.message;
|
||||||
@ -29,3 +28,10 @@ export class TypeError extends Error {
|
|||||||
this.name = "TypeError";
|
this.name = "TypeError";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class SyntaxError extends Error {
|
||||||
|
constructor(message: string = "") {
|
||||||
|
super(message);
|
||||||
|
this.name = "SyntaxError";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
68
std/assembly/index.d.ts
vendored
68
std/assembly/index.d.ts
vendored
@ -447,45 +447,47 @@ declare class DataView {
|
|||||||
/** Constructs a new `DataView` with the given properties */
|
/** Constructs a new `DataView` with the given properties */
|
||||||
constructor(buffer: ArrayBuffer, byteOffset?: i32, byteLength?: i32);
|
constructor(buffer: ArrayBuffer, byteOffset?: i32, byteLength?: i32);
|
||||||
/** The `getFloat32()` method gets a signed 32-bit float (float) at the specified byte offset from the start of the `DataView`. */
|
/** The `getFloat32()` method gets a signed 32-bit float (float) at the specified byte offset from the start of the `DataView`. */
|
||||||
getFloat32(byteOffset: i32, littleEndian?: boolean): f32
|
getFloat32(byteOffset: i32, littleEndian?: boolean): f32;
|
||||||
/** The `getFloat64()` method gets a signed 64-bit float (double) at the specified byte offset from the start of the `DataView`. */
|
/** The `getFloat64()` method gets a signed 64-bit float (double) at the specified byte offset from the start of the `DataView`. */
|
||||||
getFloat64(byteOffset: i32, littleEndian?: boolean): f64
|
getFloat64(byteOffset: i32, littleEndian?: boolean): f64;
|
||||||
/** The `getInt8()` method gets a signed 8-bit integer (byte) at the specified byte offset from the start of the `DataView`. */
|
/** The `getInt8()` method gets a signed 8-bit integer (byte) at the specified byte offset from the start of the `DataView`. */
|
||||||
getInt8(byteOffset: i32): i8
|
getInt8(byteOffset: i32): i8;
|
||||||
/** The `getInt16()` method gets a signed 16-bit integer (short) at the specified byte offset from the start of the `DataView`. */
|
/** The `getInt16()` method gets a signed 16-bit integer (short) at the specified byte offset from the start of the `DataView`. */
|
||||||
getInt16(byteOffset: i32, littleEndian?: boolean): i16
|
getInt16(byteOffset: i32, littleEndian?: boolean): i16;
|
||||||
/** The `getInt32()` method gets a signed 32-bit integer (long) at the specified byte offset from the start of the `DataView`. */
|
/** The `getInt32()` method gets a signed 32-bit integer (long) at the specified byte offset from the start of the `DataView`. */
|
||||||
getInt32(byteOffset: i32, littleEndian?: boolean): i32
|
getInt32(byteOffset: i32, littleEndian?: boolean): i32;
|
||||||
/** The `getInt64()` method gets a signed 64-bit integer (long long) at the specified byte offset from the start of the `DataView`. */
|
/** The `getInt64()` method gets a signed 64-bit integer (long long) at the specified byte offset from the start of the `DataView`. */
|
||||||
getInt64(byteOffset: i32, littleEndian?: boolean): i64
|
getInt64(byteOffset: i32, littleEndian?: boolean): i64;
|
||||||
/** The `getUint8()` method gets an unsigned 8-bit integer (unsigned byte) at the specified byte offset from the start of the `DataView`. */
|
/** The `getUint8()` method gets an unsigned 8-bit integer (unsigned byte) at the specified byte offset from the start of the `DataView`. */
|
||||||
getUint8(byteOffset: i32): u8
|
getUint8(byteOffset: i32): u8;
|
||||||
/** The `getUint16()` method gets an unsigned 16-bit integer (unsigned short) at the specified byte offset from the start of the `DataView`. */
|
/** The `getUint16()` method gets an unsigned 16-bit integer (unsigned short) at the specified byte offset from the start of the `DataView`. */
|
||||||
getUint16(byteOffset: i32, littleEndian?: boolean): u16
|
getUint16(byteOffset: i32, littleEndian?: boolean): u16;
|
||||||
/** The `getUint32()` method gets an unsigned 32-bit integer (unsigned long) at the specified byte offset from the start of the `DataView`. */
|
/** The `getUint32()` method gets an unsigned 32-bit integer (unsigned long) at the specified byte offset from the start of the `DataView`. */
|
||||||
getUint32(byteOffset: i32, littleEndian?: boolean): u32
|
getUint32(byteOffset: i32, littleEndian?: boolean): u32;
|
||||||
/** The `getUint64()` method gets an unsigned 64-bit integer (unsigned long long) at the specified byte offset from the start of the `DataView`. */
|
/** The `getUint64()` method gets an unsigned 64-bit integer (unsigned long long) at the specified byte offset from the start of the `DataView`. */
|
||||||
getUint64(byteOffset: i32, littleEndian?: boolean): u64
|
getUint64(byteOffset: i32, littleEndian?: boolean): u64;
|
||||||
/** The `setFloat32()` method stores a signed 32-bit float (float) value at the specified byte offset from the start of the `DataView`. */
|
/** The `setFloat32()` method stores a signed 32-bit float (float) value at the specified byte offset from the start of the `DataView`. */
|
||||||
setFloat32(byteOffset: i32, value: f32, littleEndian?: boolean): void
|
setFloat32(byteOffset: i32, value: f32, littleEndian?: boolean): void;
|
||||||
/** The `setFloat64()` method stores a signed 64-bit float (double) value at the specified byte offset from the start of the `DataView`. */
|
/** The `setFloat64()` method stores a signed 64-bit float (double) value at the specified byte offset from the start of the `DataView`. */
|
||||||
setFloat64(byteOffset: i32, value: f64, littleEndian?: boolean): void
|
setFloat64(byteOffset: i32, value: f64, littleEndian?: boolean): void;
|
||||||
/** The `setInt8()` method stores a signed 8-bit integer (byte) value at the specified byte offset from the start of the `DataView`. */
|
/** The `setInt8()` method stores a signed 8-bit integer (byte) value at the specified byte offset from the start of the `DataView`. */
|
||||||
setInt8(byteOffset: i32, value: i8): void
|
setInt8(byteOffset: i32, value: i8): void;
|
||||||
/** The `setInt16()` method stores a signed 16-bit integer (short) value at the specified byte offset from the start of the `DataView`. */
|
/** The `setInt16()` method stores a signed 16-bit integer (short) value at the specified byte offset from the start of the `DataView`. */
|
||||||
setInt16(byteOffset: i32, value: i16, littleEndian?: boolean): void
|
setInt16(byteOffset: i32, value: i16, littleEndian?: boolean): void;
|
||||||
/** The `setInt32()` method stores a signed 32-bit integer (long) value at the specified byte offset from the start of the `DataView`. */
|
/** The `setInt32()` method stores a signed 32-bit integer (long) value at the specified byte offset from the start of the `DataView`. */
|
||||||
setInt32(byteOffset: i32, value: i32, littleEndian?: boolean): void
|
setInt32(byteOffset: i32, value: i32, littleEndian?: boolean): void;
|
||||||
/** The `setInt64()` method stores a signed 64-bit integer (long long) value at the specified byte offset from the start of the `DataView`. */
|
/** The `setInt64()` method stores a signed 64-bit integer (long long) value at the specified byte offset from the start of the `DataView`. */
|
||||||
setInt64(byteOffset: i32, value: i64, littleEndian?: boolean): void
|
setInt64(byteOffset: i32, value: i64, littleEndian?: boolean): void;
|
||||||
/** The `setUint8()` method stores an unsigned 8-bit integer (byte) value at the specified byte offset from the start of the `DataView`. */
|
/** The `setUint8()` method stores an unsigned 8-bit integer (byte) value at the specified byte offset from the start of the `DataView`. */
|
||||||
setUint8(byteOffset: i32, value: u8): void
|
setUint8(byteOffset: i32, value: u8): void;
|
||||||
/** The `setUint16()` method stores an unsigned 16-bit integer (unsigned short) value at the specified byte offset from the start of the `DataView`. */
|
/** The `setUint16()` method stores an unsigned 16-bit integer (unsigned short) value at the specified byte offset from the start of the `DataView`. */
|
||||||
setUint16(byteOffset: i32, value: u16, littleEndian?: boolean): void
|
setUint16(byteOffset: i32, value: u16, littleEndian?: boolean): void;
|
||||||
/** The `setUint32()` method stores an unsigned 32-bit integer (unsigned long) value at the specified byte offset from the start of the `DataView`. */
|
/** The `setUint32()` method stores an unsigned 32-bit integer (unsigned long) value at the specified byte offset from the start of the `DataView`. */
|
||||||
setUint32(byteOffset: i32, value: u32, littleEndian?: boolean): void
|
setUint32(byteOffset: i32, value: u32, littleEndian?: boolean): void;
|
||||||
/** The `setUint64()` method stores an unsigned 64-bit integer (unsigned long long) value at the specified byte offset from the start of the `DataView`. */
|
/** The `setUint64()` method stores an unsigned 64-bit integer (unsigned long long) value at the specified byte offset from the start of the `DataView`. */
|
||||||
setUint64(byteOffset: i32, value: u64, littleEndian?: boolean): void
|
setUint64(byteOffset: i32, value: u64, littleEndian?: boolean): void;
|
||||||
|
/** Returns a string representation of DataView. */
|
||||||
|
toString(): string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Interface for a typed view on an array buffer. */
|
/** Interface for a typed view on an array buffer. */
|
||||||
@ -621,15 +623,24 @@ declare class Error {
|
|||||||
message: string;
|
message: string;
|
||||||
|
|
||||||
/** Stack trace. */
|
/** Stack trace. */
|
||||||
stack: string;
|
stack?: string;
|
||||||
|
|
||||||
/** Constructs a new error, optionally with a message. */
|
/** Constructs a new error, optionally with a message. */
|
||||||
constructor(message?: string);
|
constructor(message?: string);
|
||||||
|
|
||||||
|
/** Method returns a string representing the specified Error class. */
|
||||||
|
toString(): string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Class for indicating an error when a value is not in the set or range of allowed values. */
|
/** Class for indicating an error when a value is not in the set or range of allowed values. */
|
||||||
declare class RangeError extends Error { }
|
declare class RangeError extends Error { }
|
||||||
|
|
||||||
|
/** Class for indicating an error when a value is not of the expected type. */
|
||||||
|
declare class TypeError extends Error { }
|
||||||
|
|
||||||
|
/** Class for indicating an error when trying to interpret syntactically invalid code. */
|
||||||
|
declare class SyntaxError extends Error { }
|
||||||
|
|
||||||
interface Boolean {}
|
interface Boolean {}
|
||||||
interface Function {}
|
interface Function {}
|
||||||
interface IArguments {}
|
interface IArguments {}
|
||||||
@ -644,6 +655,7 @@ declare class Map<K,V> {
|
|||||||
get(key: K): V;
|
get(key: K): V;
|
||||||
delete(key: K): bool;
|
delete(key: K): bool;
|
||||||
clear(): void;
|
clear(): void;
|
||||||
|
toString(): string;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare class Set<T> {
|
declare class Set<T> {
|
||||||
@ -652,13 +664,27 @@ declare class Set<T> {
|
|||||||
add(value: T): void;
|
add(value: T): void;
|
||||||
delete(value: T): bool;
|
delete(value: T): bool;
|
||||||
clear(): void;
|
clear(): void;
|
||||||
|
toString(): string;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface SymbolConstructor {
|
interface SymbolConstructor {
|
||||||
|
readonly hasInstance: symbol;
|
||||||
|
readonly isConcatSpreadable: symbol;
|
||||||
|
readonly isRegExp: symbol;
|
||||||
|
readonly iterator: symbol;
|
||||||
|
readonly match: symbol;
|
||||||
|
readonly replace: symbol;
|
||||||
|
readonly search: symbol;
|
||||||
|
readonly species: symbol;
|
||||||
|
readonly split: symbol;
|
||||||
|
readonly toPrimitive: symbol;
|
||||||
|
readonly toStringTag: symbol;
|
||||||
|
readonly unscopables: symbol;
|
||||||
(description?: string | null): symbol;
|
(description?: string | null): symbol;
|
||||||
for(key: string): symbol;
|
for(key: string): symbol;
|
||||||
keyFor(sym: symbol): string | null;
|
keyFor(sym: symbol): string | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare const Symbol: SymbolConstructor;
|
declare const Symbol: SymbolConstructor;
|
||||||
|
|
||||||
interface IMath<T> {
|
interface IMath<T> {
|
||||||
|
@ -165,6 +165,10 @@ export class Map<K,V> {
|
|||||||
this.entriesOffset = this.entriesCount;
|
this.entriesOffset = this.entriesCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
toString(): string {
|
||||||
|
return "[object Map]";
|
||||||
|
}
|
||||||
|
|
||||||
private __gc(): void {
|
private __gc(): void {
|
||||||
__gc_mark(changetype<usize>(this.buckets)); // tslint:disable-line
|
__gc_mark(changetype<usize>(this.buckets)); // tslint:disable-line
|
||||||
var entries = this.entries;
|
var entries = this.entries;
|
||||||
|
@ -153,6 +153,10 @@ export class Set<K> {
|
|||||||
this.entriesOffset = this.entriesCount;
|
this.entriesOffset = this.entriesCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
toString(): string {
|
||||||
|
return "[object Set]";
|
||||||
|
}
|
||||||
|
|
||||||
private __gc(): void {
|
private __gc(): void {
|
||||||
__gc_mark(changetype<usize>(this.buckets)); // tslint:disable-line
|
__gc_mark(changetype<usize>(this.buckets)); // tslint:disable-line
|
||||||
var entries = this.entries;
|
var entries = this.entries;
|
||||||
|
@ -4,7 +4,30 @@ var stringToId: Map<string, usize>;
|
|||||||
var idToString: Map<usize, string>;
|
var idToString: Map<usize, string>;
|
||||||
var nextId: usize = 12; // Symbol.unscopables + 1
|
var nextId: usize = 12; // Symbol.unscopables + 1
|
||||||
|
|
||||||
@unmanaged export class symbol {}
|
@unmanaged export class symbol {
|
||||||
|
toString(): string {
|
||||||
|
var id = changetype<usize>(this);
|
||||||
|
var str = "";
|
||||||
|
switch (id) {
|
||||||
|
case 1: { str = "hasInstance"; break; }
|
||||||
|
case 2: { str = "isConcatSpreadable"; break; }
|
||||||
|
case 3: { str = "isRegExp"; break; }
|
||||||
|
case 4: { str = "match"; break; }
|
||||||
|
case 5: { str = "replace"; break; }
|
||||||
|
case 6: { str = "search"; break; }
|
||||||
|
case 7: { str = "species"; break; }
|
||||||
|
case 8: { str = "split"; break; }
|
||||||
|
case 9: { str = "toPrimitive"; break; }
|
||||||
|
case 10: { str = "toStringTag"; break; }
|
||||||
|
case 11: { str = "unscopables"; break; }
|
||||||
|
default: {
|
||||||
|
if (idToString !== null && idToString.has(id)) str = idToString.get(id);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "Symbol(" + str + ")";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
type Symbol = symbol;
|
type Symbol = symbol;
|
||||||
|
|
||||||
@ -17,18 +40,18 @@ export function Symbol(description: string | null = null): symbol {
|
|||||||
export namespace Symbol {
|
export namespace Symbol {
|
||||||
|
|
||||||
// well-known symbols
|
// well-known symbols
|
||||||
export const hasInstance = changetype<symbol>(1);
|
export const hasInstance = changetype<symbol>(1);
|
||||||
export const concatSpreadable = changetype<symbol>(2);
|
export const isConcatSpreadable = changetype<symbol>(2);
|
||||||
export const isRegExp = changetype<symbol>(3);
|
export const isRegExp = changetype<symbol>(3);
|
||||||
export const iterator = changetype<symbol>(3);
|
export const iterator = changetype<symbol>(3);
|
||||||
export const match = changetype<symbol>(4);
|
export const match = changetype<symbol>(4);
|
||||||
export const replace = changetype<symbol>(5);
|
export const replace = changetype<symbol>(5);
|
||||||
export const search = changetype<symbol>(6);
|
export const search = changetype<symbol>(6);
|
||||||
export const species = changetype<symbol>(7);
|
export const species = changetype<symbol>(7);
|
||||||
export const split = changetype<symbol>(8);
|
export const split = changetype<symbol>(8);
|
||||||
export const toPrimitive = changetype<symbol>(9);
|
export const toPrimitive = changetype<symbol>(9);
|
||||||
export const toStringTag = changetype<symbol>(10);
|
export const toStringTag = changetype<symbol>(10);
|
||||||
export const unscopables = changetype<symbol>(11);
|
export const unscopables = changetype<symbol>(11);
|
||||||
|
|
||||||
/* tslint:disable */// not valid TS
|
/* tslint:disable */// not valid TS
|
||||||
export function for(key: string): symbol {
|
export function for(key: string): symbol {
|
||||||
|
77
std/portable/index.d.ts
vendored
77
std/portable/index.d.ts
vendored
@ -297,6 +297,8 @@ declare class ArrayBuffer {
|
|||||||
constructor(length: i32);
|
constructor(length: i32);
|
||||||
/** Returns a copy of this array buffer's bytes from begin, inclusive, up to end, exclusive. */
|
/** Returns a copy of this array buffer's bytes from begin, inclusive, up to end, exclusive. */
|
||||||
slice(begin?: i32, end?: i32): ArrayBuffer;
|
slice(begin?: i32, end?: i32): ArrayBuffer;
|
||||||
|
/** Returns a string representation of ArrayBuffer. */
|
||||||
|
toString(): string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** The `DataView` view provides a low-level interface for reading and writing multiple number types in a binary `ArrayBuffer`, without having to care about the platform's endianness. */
|
/** The `DataView` view provides a low-level interface for reading and writing multiple number types in a binary `ArrayBuffer`, without having to care about the platform's endianness. */
|
||||||
@ -310,37 +312,39 @@ declare class DataView {
|
|||||||
/** Constructs a new `DataView` with the given properties */
|
/** Constructs a new `DataView` with the given properties */
|
||||||
constructor(buffer: ArrayBuffer, byteOffset?: i32, byteLength?: i32);
|
constructor(buffer: ArrayBuffer, byteOffset?: i32, byteLength?: i32);
|
||||||
/** The `getFloat32()` method gets a signed 32-bit float (float) at the specified byte offset from the start of the `DataView`. */
|
/** The `getFloat32()` method gets a signed 32-bit float (float) at the specified byte offset from the start of the `DataView`. */
|
||||||
getFloat32(byteOffset: i32, littleEndian?: boolean): f32
|
getFloat32(byteOffset: i32, littleEndian?: boolean): f32;
|
||||||
/** The `getFloat64()` method gets a signed 64-bit float (double) at the specified byte offset from the start of the `DataView`. */
|
/** The `getFloat64()` method gets a signed 64-bit float (double) at the specified byte offset from the start of the `DataView`. */
|
||||||
getFloat64(byteOffset: i32, littleEndian?: boolean): f64
|
getFloat64(byteOffset: i32, littleEndian?: boolean): f64;
|
||||||
/** The `getInt8()` method gets a signed 8-bit integer (byte) at the specified byte offset from the start of the `DataView`. */
|
/** The `getInt8()` method gets a signed 8-bit integer (byte) at the specified byte offset from the start of the `DataView`. */
|
||||||
getInt8(byteOffset: i32): i8
|
getInt8(byteOffset: i32): i8;
|
||||||
/** The `getInt16()` method gets a signed 16-bit integer (short) at the specified byte offset from the start of the `DataView`. */
|
/** The `getInt16()` method gets a signed 16-bit integer (short) at the specified byte offset from the start of the `DataView`. */
|
||||||
getInt16(byteOffset: i32, littleEndian?: boolean): i16
|
getInt16(byteOffset: i32, littleEndian?: boolean): i16;
|
||||||
/** The `getInt32()` method gets a signed 32-bit integer (long) at the specified byte offset from the start of the `DataView`. */
|
/** The `getInt32()` method gets a signed 32-bit integer (long) at the specified byte offset from the start of the `DataView`. */
|
||||||
getInt32(byteOffset: i32, littleEndian?: boolean): i32
|
getInt32(byteOffset: i32, littleEndian?: boolean): i32;
|
||||||
/** The `getUint8()` method gets an unsigned 8-bit integer (unsigned byte) at the specified byte offset from the start of the `DataView`. */
|
/** The `getUint8()` method gets an unsigned 8-bit integer (unsigned byte) at the specified byte offset from the start of the `DataView`. */
|
||||||
getUint8(byteOffset: i32): u8
|
getUint8(byteOffset: i32): u8;
|
||||||
/** The `getUint16()` method gets an unsigned 16-bit integer (unsigned short) at the specified byte offset from the start of the `DataView`. */
|
/** The `getUint16()` method gets an unsigned 16-bit integer (unsigned short) at the specified byte offset from the start of the `DataView`. */
|
||||||
getUint16(byteOffset: i32, littleEndian?: boolean): u16
|
getUint16(byteOffset: i32, littleEndian?: boolean): u16;
|
||||||
/** The `getUint32()` method gets an unsigned 32-bit integer (unsigned long) at the specified byte offset from the start of the `DataView`. */
|
/** The `getUint32()` method gets an unsigned 32-bit integer (unsigned long) at the specified byte offset from the start of the `DataView`. */
|
||||||
getUint32(byteOffset: i32, littleEndian?: boolean): u32
|
getUint32(byteOffset: i32, littleEndian?: boolean): u32;
|
||||||
/** The `setFloat32()` method stores a signed 32-bit float (float) value at the specified byte offset from the start of the `DataView`. */
|
/** The `setFloat32()` method stores a signed 32-bit float (float) value at the specified byte offset from the start of the `DataView`. */
|
||||||
setFloat32(byteOffset: i32, value: f32, littleEndian?: boolean): void
|
setFloat32(byteOffset: i32, value: f32, littleEndian?: boolean): void;
|
||||||
/** The `setFloat64()` method stores a signed 64-bit float (double) value at the specified byte offset from the start of the `DataView`. */
|
/** The `setFloat64()` method stores a signed 64-bit float (double) value at the specified byte offset from the start of the `DataView`. */
|
||||||
setFloat64(byteOffset: i32, value: f64, littleEndian?: boolean): void
|
setFloat64(byteOffset: i32, value: f64, littleEndian?: boolean): void;
|
||||||
/** The `setInt8()` method stores a signed 8-bit integer (byte) value at the specified byte offset from the start of the `DataView`. */
|
/** The `setInt8()` method stores a signed 8-bit integer (byte) value at the specified byte offset from the start of the `DataView`. */
|
||||||
setInt8(byteOffset: i32, value: i8): void
|
setInt8(byteOffset: i32, value: i8): void;
|
||||||
/** The `setInt16()` method stores a signed 16-bit integer (short) value at the specified byte offset from the start of the `DataView`. */
|
/** The `setInt16()` method stores a signed 16-bit integer (short) value at the specified byte offset from the start of the `DataView`. */
|
||||||
setInt16(byteOffset: i32, value: i16, littleEndian?: boolean): void
|
setInt16(byteOffset: i32, value: i16, littleEndian?: boolean): void;
|
||||||
/** The `setInt32()` method stores a signed 32-bit integer (long) value at the specified byte offset from the start of the `DataView`. */
|
/** The `setInt32()` method stores a signed 32-bit integer (long) value at the specified byte offset from the start of the `DataView`. */
|
||||||
setInt32(byteOffset: i32, value: i32, littleEndian?: boolean): void
|
setInt32(byteOffset: i32, value: i32, littleEndian?: boolean): void;
|
||||||
/** The `setUint8()` method stores an unsigned 8-bit integer (byte) value at the specified byte offset from the start of the `DataView`. */
|
/** The `setUint8()` method stores an unsigned 8-bit integer (byte) value at the specified byte offset from the start of the `DataView`. */
|
||||||
setUint8(byteOffset: i32, value: u8): void
|
setUint8(byteOffset: i32, value: u8): void;
|
||||||
/** The `setUint16()` method stores an unsigned 16-bit integer (unsigned short) value at the specified byte offset from the start of the `DataView`. */
|
/** The `setUint16()` method stores an unsigned 16-bit integer (unsigned short) value at the specified byte offset from the start of the `DataView`. */
|
||||||
setUint16(byteOffset: i32, value: u16, littleEndian?: boolean): void
|
setUint16(byteOffset: i32, value: u16, littleEndian?: boolean): void;
|
||||||
/** The `setUint32()` method stores an unsigned 32-bit integer (unsigned long) value at the specified byte offset from the start of the `DataView`. */
|
/** The `setUint32()` method stores an unsigned 32-bit integer (unsigned long) value at the specified byte offset from the start of the `DataView`. */
|
||||||
setUint32(byteOffset: i32, value: u32, littleEndian?: boolean): void
|
setUint32(byteOffset: i32, value: u32, littleEndian?: boolean): void;
|
||||||
|
/** Returns a string representation of DataView. */
|
||||||
|
toString(): string;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare class Array<T> {
|
declare class Array<T> {
|
||||||
@ -435,12 +439,34 @@ interface RegExp {}
|
|||||||
|
|
||||||
interface IArguments {}
|
interface IArguments {}
|
||||||
|
|
||||||
|
/** Class for representing a runtime error. Base class of all errors. */
|
||||||
declare class Error {
|
declare class Error {
|
||||||
constructor(message: string);
|
|
||||||
|
/** Error name. */
|
||||||
|
name: string;
|
||||||
|
|
||||||
|
/** Message provided on construction. */
|
||||||
message: string;
|
message: string;
|
||||||
stack: string | null;
|
|
||||||
|
/** Stack trace. */
|
||||||
|
stack?: string;
|
||||||
|
|
||||||
|
/** Constructs a new error, optionally with a message. */
|
||||||
|
constructor(message?: string);
|
||||||
|
|
||||||
|
/** Method returns a string representing the specified Error class. */
|
||||||
|
toString(): string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Class for indicating an error when a value is not in the set or range of allowed values. */
|
||||||
|
declare class RangeError extends Error { }
|
||||||
|
|
||||||
|
/** Class for indicating an error when a value is not of the expected type. */
|
||||||
|
declare class TypeError extends Error { }
|
||||||
|
|
||||||
|
/** Class for indicating an error when trying to interpret syntactically invalid code. */
|
||||||
|
declare class SyntaxError extends Error { }
|
||||||
|
|
||||||
declare class Set<T> {
|
declare class Set<T> {
|
||||||
constructor(entries?: T[]);
|
constructor(entries?: T[]);
|
||||||
readonly size: i32;
|
readonly size: i32;
|
||||||
@ -448,6 +474,7 @@ declare class Set<T> {
|
|||||||
add(value: T): void;
|
add(value: T): void;
|
||||||
delete(value: T): bool;
|
delete(value: T): bool;
|
||||||
clear(): void;
|
clear(): void;
|
||||||
|
toString(): string;
|
||||||
[Symbol.iterator](): Iterator<T>;
|
[Symbol.iterator](): Iterator<T>;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -462,14 +489,26 @@ declare class Map<K,V> {
|
|||||||
keys(): Iterable<K>;
|
keys(): Iterable<K>;
|
||||||
values(): Iterable<V>;
|
values(): Iterable<V>;
|
||||||
delete(key: K): bool;
|
delete(key: K): bool;
|
||||||
|
toString(): string;
|
||||||
[Symbol.iterator](): Iterator<[K,V]>;
|
[Symbol.iterator](): Iterator<[K,V]>;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface SymbolConstructor {
|
interface SymbolConstructor {
|
||||||
|
readonly hasInstance: symbol;
|
||||||
|
readonly isConcatSpreadable: symbol;
|
||||||
|
readonly isRegExp: symbol;
|
||||||
|
readonly iterator: symbol;
|
||||||
|
readonly match: symbol;
|
||||||
|
readonly replace: symbol;
|
||||||
|
readonly search: symbol;
|
||||||
|
readonly species: symbol;
|
||||||
|
readonly split: symbol;
|
||||||
|
readonly toPrimitive: symbol;
|
||||||
|
readonly toStringTag: symbol;
|
||||||
|
readonly unscopables: symbol;
|
||||||
(description?: string | null): symbol;
|
(description?: string | null): symbol;
|
||||||
for(key: string): symbol;
|
for(key: string): symbol;
|
||||||
keyFor(sym: symbol): string | null;
|
keyFor(sym: symbol): string | null;
|
||||||
readonly iterator: symbol;
|
|
||||||
}
|
}
|
||||||
declare const Symbol: SymbolConstructor;
|
declare const Symbol: SymbolConstructor;
|
||||||
|
|
||||||
|
@ -478,7 +478,7 @@
|
|||||||
if
|
if
|
||||||
i32.const 0
|
i32.const 0
|
||||||
i32.const 136
|
i32.const 136
|
||||||
i32.const 184
|
i32.const 188
|
||||||
i32.const 73
|
i32.const 73
|
||||||
call $~lib/env/abort
|
call $~lib/env/abort
|
||||||
unreachable
|
unreachable
|
||||||
@ -553,7 +553,7 @@
|
|||||||
if
|
if
|
||||||
i32.const 0
|
i32.const 0
|
||||||
i32.const 136
|
i32.const 136
|
||||||
i32.const 184
|
i32.const 188
|
||||||
i32.const 73
|
i32.const 73
|
||||||
call $~lib/env/abort
|
call $~lib/env/abort
|
||||||
unreachable
|
unreachable
|
||||||
@ -602,7 +602,7 @@
|
|||||||
if
|
if
|
||||||
i32.const 0
|
i32.const 0
|
||||||
i32.const 136
|
i32.const 136
|
||||||
i32.const 184
|
i32.const 188
|
||||||
i32.const 73
|
i32.const 73
|
||||||
call $~lib/env/abort
|
call $~lib/env/abort
|
||||||
unreachable
|
unreachable
|
||||||
@ -639,7 +639,7 @@
|
|||||||
if
|
if
|
||||||
i32.const 0
|
i32.const 0
|
||||||
i32.const 136
|
i32.const 136
|
||||||
i32.const 184
|
i32.const 188
|
||||||
i32.const 73
|
i32.const 73
|
||||||
call $~lib/env/abort
|
call $~lib/env/abort
|
||||||
unreachable
|
unreachable
|
||||||
@ -696,7 +696,7 @@
|
|||||||
if
|
if
|
||||||
i32.const 0
|
i32.const 0
|
||||||
i32.const 136
|
i32.const 136
|
||||||
i32.const 184
|
i32.const 188
|
||||||
i32.const 73
|
i32.const 73
|
||||||
call $~lib/env/abort
|
call $~lib/env/abort
|
||||||
unreachable
|
unreachable
|
||||||
@ -739,7 +739,7 @@
|
|||||||
if
|
if
|
||||||
i32.const 0
|
i32.const 0
|
||||||
i32.const 136
|
i32.const 136
|
||||||
i32.const 184
|
i32.const 188
|
||||||
i32.const 73
|
i32.const 73
|
||||||
call $~lib/env/abort
|
call $~lib/env/abort
|
||||||
unreachable
|
unreachable
|
||||||
@ -785,7 +785,7 @@
|
|||||||
if
|
if
|
||||||
i32.const 0
|
i32.const 0
|
||||||
i32.const 136
|
i32.const 136
|
||||||
i32.const 184
|
i32.const 188
|
||||||
i32.const 73
|
i32.const 73
|
||||||
call $~lib/env/abort
|
call $~lib/env/abort
|
||||||
unreachable
|
unreachable
|
||||||
@ -822,7 +822,7 @@
|
|||||||
if
|
if
|
||||||
i32.const 0
|
i32.const 0
|
||||||
i32.const 136
|
i32.const 136
|
||||||
i32.const 184
|
i32.const 188
|
||||||
i32.const 73
|
i32.const 73
|
||||||
call $~lib/env/abort
|
call $~lib/env/abort
|
||||||
unreachable
|
unreachable
|
||||||
@ -863,7 +863,7 @@
|
|||||||
if
|
if
|
||||||
i32.const 0
|
i32.const 0
|
||||||
i32.const 136
|
i32.const 136
|
||||||
i32.const 184
|
i32.const 188
|
||||||
i32.const 73
|
i32.const 73
|
||||||
call $~lib/env/abort
|
call $~lib/env/abort
|
||||||
unreachable
|
unreachable
|
||||||
@ -909,7 +909,7 @@
|
|||||||
if
|
if
|
||||||
i32.const 0
|
i32.const 0
|
||||||
i32.const 136
|
i32.const 136
|
||||||
i32.const 184
|
i32.const 188
|
||||||
i32.const 73
|
i32.const 73
|
||||||
call $~lib/env/abort
|
call $~lib/env/abort
|
||||||
unreachable
|
unreachable
|
||||||
@ -945,7 +945,7 @@
|
|||||||
if
|
if
|
||||||
i32.const 0
|
i32.const 0
|
||||||
i32.const 136
|
i32.const 136
|
||||||
i32.const 184
|
i32.const 188
|
||||||
i32.const 73
|
i32.const 73
|
||||||
call $~lib/env/abort
|
call $~lib/env/abort
|
||||||
unreachable
|
unreachable
|
||||||
@ -966,7 +966,7 @@
|
|||||||
if
|
if
|
||||||
i32.const 0
|
i32.const 0
|
||||||
i32.const 136
|
i32.const 136
|
||||||
i32.const 184
|
i32.const 188
|
||||||
i32.const 73
|
i32.const 73
|
||||||
call $~lib/env/abort
|
call $~lib/env/abort
|
||||||
unreachable
|
unreachable
|
||||||
@ -1007,7 +1007,7 @@
|
|||||||
if
|
if
|
||||||
i32.const 0
|
i32.const 0
|
||||||
i32.const 136
|
i32.const 136
|
||||||
i32.const 184
|
i32.const 188
|
||||||
i32.const 73
|
i32.const 73
|
||||||
call $~lib/env/abort
|
call $~lib/env/abort
|
||||||
unreachable
|
unreachable
|
||||||
@ -1048,7 +1048,7 @@
|
|||||||
if
|
if
|
||||||
i32.const 0
|
i32.const 0
|
||||||
i32.const 136
|
i32.const 136
|
||||||
i32.const 184
|
i32.const 188
|
||||||
i32.const 73
|
i32.const 73
|
||||||
call $~lib/env/abort
|
call $~lib/env/abort
|
||||||
unreachable
|
unreachable
|
||||||
@ -1080,7 +1080,7 @@
|
|||||||
if
|
if
|
||||||
i32.const 0
|
i32.const 0
|
||||||
i32.const 136
|
i32.const 136
|
||||||
i32.const 184
|
i32.const 188
|
||||||
i32.const 73
|
i32.const 73
|
||||||
call $~lib/env/abort
|
call $~lib/env/abort
|
||||||
unreachable
|
unreachable
|
||||||
|
@ -623,7 +623,7 @@
|
|||||||
if
|
if
|
||||||
i32.const 0
|
i32.const 0
|
||||||
i32.const 136
|
i32.const 136
|
||||||
i32.const 184
|
i32.const 188
|
||||||
i32.const 73
|
i32.const 73
|
||||||
call $~lib/env/abort
|
call $~lib/env/abort
|
||||||
unreachable
|
unreachable
|
||||||
@ -717,7 +717,7 @@
|
|||||||
if
|
if
|
||||||
i32.const 0
|
i32.const 0
|
||||||
i32.const 136
|
i32.const 136
|
||||||
i32.const 184
|
i32.const 188
|
||||||
i32.const 73
|
i32.const 73
|
||||||
call $~lib/env/abort
|
call $~lib/env/abort
|
||||||
unreachable
|
unreachable
|
||||||
@ -772,7 +772,7 @@
|
|||||||
if
|
if
|
||||||
i32.const 0
|
i32.const 0
|
||||||
i32.const 136
|
i32.const 136
|
||||||
i32.const 184
|
i32.const 188
|
||||||
i32.const 73
|
i32.const 73
|
||||||
call $~lib/env/abort
|
call $~lib/env/abort
|
||||||
unreachable
|
unreachable
|
||||||
@ -828,7 +828,7 @@
|
|||||||
if
|
if
|
||||||
i32.const 0
|
i32.const 0
|
||||||
i32.const 136
|
i32.const 136
|
||||||
i32.const 184
|
i32.const 188
|
||||||
i32.const 73
|
i32.const 73
|
||||||
call $~lib/env/abort
|
call $~lib/env/abort
|
||||||
unreachable
|
unreachable
|
||||||
@ -892,7 +892,7 @@
|
|||||||
if
|
if
|
||||||
i32.const 0
|
i32.const 0
|
||||||
i32.const 136
|
i32.const 136
|
||||||
i32.const 184
|
i32.const 188
|
||||||
i32.const 73
|
i32.const 73
|
||||||
call $~lib/env/abort
|
call $~lib/env/abort
|
||||||
unreachable
|
unreachable
|
||||||
@ -981,7 +981,7 @@
|
|||||||
if
|
if
|
||||||
i32.const 0
|
i32.const 0
|
||||||
i32.const 136
|
i32.const 136
|
||||||
i32.const 184
|
i32.const 188
|
||||||
i32.const 73
|
i32.const 73
|
||||||
call $~lib/env/abort
|
call $~lib/env/abort
|
||||||
unreachable
|
unreachable
|
||||||
@ -1030,7 +1030,7 @@
|
|||||||
if
|
if
|
||||||
i32.const 0
|
i32.const 0
|
||||||
i32.const 136
|
i32.const 136
|
||||||
i32.const 184
|
i32.const 188
|
||||||
i32.const 73
|
i32.const 73
|
||||||
call $~lib/env/abort
|
call $~lib/env/abort
|
||||||
unreachable
|
unreachable
|
||||||
@ -1084,7 +1084,7 @@
|
|||||||
if
|
if
|
||||||
i32.const 0
|
i32.const 0
|
||||||
i32.const 136
|
i32.const 136
|
||||||
i32.const 184
|
i32.const 188
|
||||||
i32.const 73
|
i32.const 73
|
||||||
call $~lib/env/abort
|
call $~lib/env/abort
|
||||||
unreachable
|
unreachable
|
||||||
@ -1134,7 +1134,7 @@
|
|||||||
if
|
if
|
||||||
i32.const 0
|
i32.const 0
|
||||||
i32.const 136
|
i32.const 136
|
||||||
i32.const 184
|
i32.const 188
|
||||||
i32.const 73
|
i32.const 73
|
||||||
call $~lib/env/abort
|
call $~lib/env/abort
|
||||||
unreachable
|
unreachable
|
||||||
@ -1184,7 +1184,7 @@
|
|||||||
if
|
if
|
||||||
i32.const 0
|
i32.const 0
|
||||||
i32.const 136
|
i32.const 136
|
||||||
i32.const 184
|
i32.const 188
|
||||||
i32.const 73
|
i32.const 73
|
||||||
call $~lib/env/abort
|
call $~lib/env/abort
|
||||||
unreachable
|
unreachable
|
||||||
@ -1233,7 +1233,7 @@
|
|||||||
if
|
if
|
||||||
i32.const 0
|
i32.const 0
|
||||||
i32.const 136
|
i32.const 136
|
||||||
i32.const 184
|
i32.const 188
|
||||||
i32.const 73
|
i32.const 73
|
||||||
call $~lib/env/abort
|
call $~lib/env/abort
|
||||||
unreachable
|
unreachable
|
||||||
@ -1290,7 +1290,7 @@
|
|||||||
if
|
if
|
||||||
i32.const 0
|
i32.const 0
|
||||||
i32.const 136
|
i32.const 136
|
||||||
i32.const 184
|
i32.const 188
|
||||||
i32.const 73
|
i32.const 73
|
||||||
call $~lib/env/abort
|
call $~lib/env/abort
|
||||||
unreachable
|
unreachable
|
||||||
@ -1347,7 +1347,7 @@
|
|||||||
if
|
if
|
||||||
i32.const 0
|
i32.const 0
|
||||||
i32.const 136
|
i32.const 136
|
||||||
i32.const 184
|
i32.const 188
|
||||||
i32.const 73
|
i32.const 73
|
||||||
call $~lib/env/abort
|
call $~lib/env/abort
|
||||||
unreachable
|
unreachable
|
||||||
@ -1387,7 +1387,7 @@
|
|||||||
if
|
if
|
||||||
i32.const 0
|
i32.const 0
|
||||||
i32.const 136
|
i32.const 136
|
||||||
i32.const 184
|
i32.const 188
|
||||||
i32.const 73
|
i32.const 73
|
||||||
call $~lib/env/abort
|
call $~lib/env/abort
|
||||||
unreachable
|
unreachable
|
||||||
@ -1435,7 +1435,7 @@
|
|||||||
if
|
if
|
||||||
i32.const 0
|
i32.const 0
|
||||||
i32.const 136
|
i32.const 136
|
||||||
i32.const 184
|
i32.const 188
|
||||||
i32.const 73
|
i32.const 73
|
||||||
call $~lib/env/abort
|
call $~lib/env/abort
|
||||||
unreachable
|
unreachable
|
||||||
@ -1483,7 +1483,7 @@
|
|||||||
if
|
if
|
||||||
i32.const 0
|
i32.const 0
|
||||||
i32.const 136
|
i32.const 136
|
||||||
i32.const 184
|
i32.const 188
|
||||||
i32.const 73
|
i32.const 73
|
||||||
call $~lib/env/abort
|
call $~lib/env/abort
|
||||||
unreachable
|
unreachable
|
||||||
@ -1531,7 +1531,7 @@
|
|||||||
if
|
if
|
||||||
i32.const 0
|
i32.const 0
|
||||||
i32.const 136
|
i32.const 136
|
||||||
i32.const 184
|
i32.const 188
|
||||||
i32.const 73
|
i32.const 73
|
||||||
call $~lib/env/abort
|
call $~lib/env/abort
|
||||||
unreachable
|
unreachable
|
||||||
@ -1571,7 +1571,7 @@
|
|||||||
if
|
if
|
||||||
i32.const 0
|
i32.const 0
|
||||||
i32.const 136
|
i32.const 136
|
||||||
i32.const 184
|
i32.const 188
|
||||||
i32.const 73
|
i32.const 73
|
||||||
call $~lib/env/abort
|
call $~lib/env/abort
|
||||||
unreachable
|
unreachable
|
||||||
@ -1619,7 +1619,7 @@
|
|||||||
if
|
if
|
||||||
i32.const 0
|
i32.const 0
|
||||||
i32.const 136
|
i32.const 136
|
||||||
i32.const 184
|
i32.const 188
|
||||||
i32.const 73
|
i32.const 73
|
||||||
call $~lib/env/abort
|
call $~lib/env/abort
|
||||||
unreachable
|
unreachable
|
||||||
@ -1667,7 +1667,7 @@
|
|||||||
if
|
if
|
||||||
i32.const 0
|
i32.const 0
|
||||||
i32.const 136
|
i32.const 136
|
||||||
i32.const 184
|
i32.const 188
|
||||||
i32.const 73
|
i32.const 73
|
||||||
call $~lib/env/abort
|
call $~lib/env/abort
|
||||||
unreachable
|
unreachable
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -22,6 +22,14 @@ var key4 = Symbol.keyFor(sym4);
|
|||||||
assert(key3 == "123");
|
assert(key3 == "123");
|
||||||
assert(key3 == key4);
|
assert(key3 == key4);
|
||||||
|
|
||||||
|
assert(Symbol().toString() == "Symbol()");
|
||||||
|
assert(sym3.toString() == "Symbol(123)");
|
||||||
|
|
||||||
|
var hasInstance = Symbol.hasInstance;
|
||||||
|
var isConcatSpreadable = Symbol.isConcatSpreadable;
|
||||||
|
assert(hasInstance.toString() == "Symbol(hasInstance)");
|
||||||
|
assert(isConcatSpreadable.toString() == "Symbol(isConcatSpreadable)");
|
||||||
|
|
||||||
Symbol.hasInstance;
|
Symbol.hasInstance;
|
||||||
Symbol.concatSpreadable;
|
Symbol.isConcatSpreadable;
|
||||||
// ...
|
// ...
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user