summaryrefslogtreecommitdiff
path: root/runtime/js/40_error_stack.js
blob: c8f2aff5a52c9627635b79476c23da0419846963 (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
25
26
27
28
29
// 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 opFormatFileName(location) {
    return core.opSync("op_format_file_name", location);
  }

  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 = {
    opFormatDiagnostics,
    opFormatFileName,
    opApplySourceMap,
  };
})(this);