Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/messaging/Message.ts
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -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');
}
Expand All @@ -154,7 +154,7 @@ export namespace Message {
export function pushEvent(topic: string, payload: string): Request<Ack> {
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');
}
Expand Down
2 changes: 1 addition & 1 deletion src/sourcemap/SourceMapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ export class AsScriptMapper implements SourceMapper {
public mapping(): Promise<Mapping> {
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) {
Expand Down
4 changes: 2 additions & 2 deletions src/testbeds/Platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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++;
}
Expand Down
2 changes: 1 addition & 1 deletion src/util/retry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export function retry<T>(promise: () => Promise<T>, retries: number): Promise<T>
try {
const result: T = await promise();
resolve(result);
} catch (e) {
} catch {
trying = ++attempt < retries;
}
}
Expand Down