mirror of
https://github.com/denoland/deno.git
synced 2024-11-26 16:09:27 -05:00
0ea6eb83a9
Renames and adds missing fields to JSStackFrame from CallSite. Fixes #4705. Cleans up base changes for line and column numbers.
27 lines
762 B
TypeScript
27 lines
762 B
TypeScript
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
|
|
import { DiagnosticItem } from "../diagnostics.ts";
|
|
import { sendSync } from "./dispatch_json.ts";
|
|
|
|
export function formatDiagnostics(items: DiagnosticItem[]): string {
|
|
return sendSync("op_format_diagnostic", { items });
|
|
}
|
|
|
|
export interface Location {
|
|
fileName: string;
|
|
lineNumber: number;
|
|
columnNumber: number;
|
|
}
|
|
|
|
export function applySourceMap(location: Location): Location {
|
|
const { fileName, lineNumber, columnNumber } = location;
|
|
const res = sendSync("op_apply_source_map", {
|
|
fileName,
|
|
lineNumber: lineNumber,
|
|
columnNumber: columnNumber,
|
|
});
|
|
return {
|
|
fileName: res.fileName,
|
|
lineNumber: res.lineNumber,
|
|
columnNumber: res.columnNumber,
|
|
};
|
|
}
|