From 81ddf9b700bc48a1f8e472209f080f9c1d9a9b09 Mon Sep 17 00:00:00 2001 From: Piotr Russ Date: Wed, 18 Nov 2020 23:26:45 +0100 Subject: rm node_modules --- .../@webassemblyjs/helper-code-frame/lib/index.js | 47 ---------------------- 1 file changed, 47 deletions(-) delete mode 100644 node_modules/@webassemblyjs/helper-code-frame/lib/index.js (limited to 'node_modules/@webassemblyjs/helper-code-frame/lib') diff --git a/node_modules/@webassemblyjs/helper-code-frame/lib/index.js b/node_modules/@webassemblyjs/helper-code-frame/lib/index.js deleted file mode 100644 index 977de89..0000000 --- a/node_modules/@webassemblyjs/helper-code-frame/lib/index.js +++ /dev/null @@ -1,47 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.codeFrameFromAst = codeFrameFromAst; -exports.codeFrameFromSource = codeFrameFromSource; - -var _wastPrinter = require("@webassemblyjs/wast-printer"); - -function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - -var SHOW_LINES_AROUND_POINTER = 5; - -function repeat(char, nb) { - return Array(nb).fill(char).join(""); -} // TODO(sven): allow arbitrary ast nodes - - -function codeFrameFromAst(ast, loc) { - return codeFrameFromSource((0, _wastPrinter.print)(ast), loc); -} - -function codeFrameFromSource(source, loc) { - var start = loc.start, - end = loc.end; - var length = 1; - - if (_typeof(end) === "object") { - length = end.column - start.column + 1; - } - - return source.split("\n").reduce(function (acc, line, lineNbr) { - if (Math.abs(start.line - lineNbr) < SHOW_LINES_AROUND_POINTER) { - acc += line + "\n"; - } // Add a new line with the pointer padded left - - - if (lineNbr === start.line - 1) { - acc += repeat(" ", start.column - 1); - acc += repeat("^", length); - acc += "\n"; - } - - return acc; - }, ""); -} \ No newline at end of file -- cgit v1.2.3