summaryrefslogtreecommitdiff
path: root/runtime/js/40_error_stack.js
blob: da2ee51f391a9b833bb6b7826e5308f5ddafd63e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.

((window) => {
  const core = window.Deno.core;

  function opFormatDiagnostics(diagnostics) {
    return core.jsonOpSync("op_format_diagnostic", diagnostics);
  }

  function opApplySourceMap(location) {
    const res = core.jsonOpSync("op_apply_source_map", location);
    return {
      fileName: res.fileName,
      lineNumber: res.lineNumber,
      columnNumber: res.columnNumber,
    };
  }

  window.__bootstrap.errorStack = {
    opApplySourceMap,
    opFormatDiagnostics,
  };
})(this);