decaffeinate-parser
Version:
A better AST for CoffeeScript, inspired by CoffeeScriptRedux.
16 lines (15 loc) • 863 B
JavaScript
;
exports.__esModule = true;
var mapAny_1 = require("../mappers/mapAny");
var nodes = require("../nodes");
var getTemplateLiteralComponents_1 = require("./getTemplateLiteralComponents");
function makeString(context, node) {
var _a = getTemplateLiteralComponents_1["default"](context, node), quasis = _a.quasis, unmappedExpressions = _a.unmappedExpressions, start = _a.start, end = _a.end;
var startLoc = context.linesAndColumns.locationForIndex(start);
if (!startLoc) {
throw new Error("Expected to find a location for index " + start + ".");
}
var raw = context.source.slice(start, end);
return new nodes.String(startLoc.line + 1, startLoc.column + 1, start, end, raw, quasis, unmappedExpressions.map(function (expr) { return (expr ? mapAny_1["default"](context, expr) : null); }));
}
exports["default"] = makeString;