UNPKG

decaffeinate-parser

Version:

A better AST for CoffeeScript, inspired by CoffeeScriptRedux.

15 lines (14 loc) 685 B
"use strict"; exports.__esModule = true; var util_1 = require("util"); var nodes_1 = require("../nodes"); var getLocation_1 = require("../util/getLocation"); var mapAny_1 = require("./mapAny"); function mapRange(context, node) { var _a = getLocation_1["default"](context, node), line = _a.line, column = _a.column, start = _a.start, end = _a.end, raw = _a.raw; if (!node.from || !node.to) { throw new Error("'from' or 'to' unexpectedly missing: " + util_1.inspect(node)); } return new nodes_1.Range(line, column, start, end, raw, mapAny_1["default"](context, node.from), mapAny_1["default"](context, node.to), !node.exclusive); } exports["default"] = mapRange;