From: Nidin Vinayakan <01@01alchemist.com> Date: Sat, 1 Apr 2017 12:05:58 +0000 (+0200) Subject: WASM Error interfaces added X-Git-Tag: otter-0.2.0~707^2~4 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=396e9ae75d4f417410897f9fc3ac808aa31ccce6;p=otter.git WASM Error interfaces added --- diff --git a/webassembly.d.ts b/webassembly.d.ts index 0fbf2e87..800da92b 100644 --- a/webassembly.d.ts +++ b/webassembly.d.ts @@ -1,13 +1,8 @@ -interface NativeError { - -} - /** * WebAssembly v1 (MVP) declaration file for TypeScript - * Author : 01alchemist (https://twitter.com/01alchemist) + * Definitions by: 01alchemist (https://twitter.com/01alchemist) */ declare namespace WebAssembly { - /** * WebAssembly.Module **/ @@ -89,20 +84,54 @@ declare namespace WebAssembly { } const Table: TableConstructor; + /** + * Errors + */ + interface CompileError extends Error { + readonly fileName: string; + readonly lineNumber: string; + readonly columnNumber: string; + toString(): string; + } + interface CompileErrorConstructor { + readonly prototype: CompileError; + new (message?:string, fileName?:string, lineNumber?:number):CompileError; + } + const CompileError: CompileErrorConstructor; - const CompileError: NativeError; - const LinkError: NativeError; - const RuntimeError: NativeError; + interface LinkError extends Error { + readonly fileName: string; + readonly lineNumber: string; + readonly columnNumber: string; + toString(): string; + } + interface LinkErrorConstructor { + readonly prototype: LinkError; + new (message?:string, fileName?:string, lineNumber?:number):LinkError; + } + const LinkError: LinkErrorConstructor; + + interface RuntimeError extends Error { + readonly fileName: string; + readonly lineNumber: string; + readonly columnNumber: string; + toString(): string; + } + interface RuntimeErrorConstructor { + readonly prototype: RuntimeError; + new (message?:string, fileName?:string, lineNumber?:number):RuntimeError; + } + const RuntimeError: RuntimeErrorConstructor; function compile(bufferSource: ArrayBuffer | Uint8Array): Promise; interface ResultObject { - module:Module; - instance:Instance; + module: Module; + instance: Instance; } function instantiate(bufferSource: ArrayBuffer | Uint8Array, importObject?: any): Promise; function instantiate(module: Module, importObject?: any): Promise; - function validate(bufferSource: ArrayBuffer | Uint8Array):boolean; -} \ No newline at end of file + function validate(bufferSource: ArrayBuffer | Uint8Array): boolean; +}