diff --git a/src/messaging/Message.ts b/src/messaging/Message.ts index 245a90b..0a9a99d 100644 --- a/src/messaging/Message.ts +++ b/src/messaging/Message.ts @@ -1,16 +1,16 @@ import {WARDuino} from '../debug/WARDuino'; -import {ackParser, breakpointParser, identityParser, invokeParser, stateParser} from './Parsers'; +import {ackParser, breakpointParser, invokeParser, stateParser} from './Parsers'; import {Breakpoint} from '../debug/Breakpoint'; import {WASM} from '../sourcemap/Wasm'; import {write} from 'ieee754'; import {SourceMap} from '../sourcemap/SourceMap'; import {readFileSync} from 'fs'; +import {CompileOutput, CompilerFactory} from '../manage/Compiler'; +import {WABT} from '../util/env'; import Interrupt = WARDuino.Interrupt; import State = WARDuino.State; import Value = WASM.Value; import Type = WASM.Type; -import {CompileOutput, CompilerFactory} from '../manage/Compiler'; -import {WABT} from '../util/env'; // An acknowledgement returned by the debugger export interface Ack { @@ -144,7 +144,7 @@ export namespace Message { return { type: Interrupt.updateModule, - payload: (map: SourceMap.Mapping) => payload(readFileSync(wasm)), + payload: () => payload(readFileSync(wasm)), parser: (line: string) => { return ackParser(line, 'CHANGE Module'); } @@ -154,7 +154,7 @@ export namespace Message { export function pushEvent(topic: string, payload: string): Request { return { type: Interrupt.pushEvent, - payload: (map: SourceMap.Mapping) => `{topic: '${topic}', payload: '${payload}'}`, + payload: () => `{topic: '${topic}', payload: '${payload}'}`, parser: (line: string) => { return ackParser(line, 'Interrupt: 73'); } diff --git a/src/sourcemap/SourceMapper.ts b/src/sourcemap/SourceMapper.ts index 17a719a..901ae4f 100644 --- a/src/sourcemap/SourceMapper.ts +++ b/src/sourcemap/SourceMapper.ts @@ -211,7 +211,7 @@ export class AsScriptMapper implements SourceMapper { public mapping(): Promise { const input = fs.readFileSync(`${this.tmpdir}/upload.wasm.map`) - return new Promise((resolve, reject) => { + return new Promise((resolve) => { new SourceMapConsumer(input.toString()).then((consumer: SourceMapConsumer) => { const mapping: Mapping = new SourceMap.Mapping().init([], [], [], []); consumer.eachMapping(function (item: MappingItem) { diff --git a/src/testbeds/Platform.ts b/src/testbeds/Platform.ts index d2859b2..7142f3b 100644 --- a/src/testbeds/Platform.ts +++ b/src/testbeds/Platform.ts @@ -60,12 +60,12 @@ export abstract class Platform extends EventEmitter implements Testbed { private search(message: string): number { let index: number = 0; while (index < this.requests.length) { - const [candidate, resolver] = this.requests[index]; + const [candidate] = this.requests[index]; try { // try candidate parser candidate.parser(message); return index; - } catch (e) { + } catch { // failure: try next request index++; } diff --git a/src/util/retry.ts b/src/util/retry.ts index 0ccd533..be03d3b 100644 --- a/src/util/retry.ts +++ b/src/util/retry.ts @@ -7,7 +7,7 @@ export function retry(promise: () => Promise, retries: number): Promise try { const result: T = await promise(); resolve(result); - } catch (e) { + } catch { trying = ++attempt < retries; } }