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

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

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

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

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