Clean up how we use opIds (#4118)

This commit is contained in:
Ryan Dahl 2020-02-25 09:14:27 -05:00 committed by GitHub
parent 805992b14a
commit 91b606aaae
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
74 changed files with 367 additions and 589 deletions

View file

@ -1,11 +1,10 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
import { DiagnosticItem } from "./diagnostics.ts";
import * as dispatch from "./dispatch.ts";
import { sendSync } from "./dispatch_json.ts";
// TODO(bartlomieju): move to `repl.ts`?
export function formatError(errString: string): string {
const res = sendSync(dispatch.OP_FORMAT_ERROR, { error: errString });
const res = sendSync("op_format_error", { error: errString });
return res.error;
}
@ -14,5 +13,5 @@ export function formatError(errString: string): string {
* @param items An array of diagnostic items to format
*/
export function formatDiagnostics(items: DiagnosticItem[]): string {
return sendSync(dispatch.OP_FORMAT_DIAGNOSTIC, { items });
return sendSync("op_format_diagnostic", { items });
}