This commit is contained in:
Felix Roos 2022-02-21 01:20:44 +01:00
parent fd5ac5898c
commit 8ce9986479
4 changed files with 5 additions and 10 deletions

View file

@ -605,13 +605,11 @@ Pattern.prototype.bootstrap = () => {
return bootstrapped;
};
function withLocationOffset(pat, offset) {
let startLine;
return pat.fmap((value) => {
value = typeof value === "object" && !Array.isArray(value) ? value : {value};
let locations = value.locations || [];
startLine = startLine || locations[0].start.line;
locations = locations.map(({start, end}) => {
const colOffset = startLine === end.line ? offset.start.column : 0;
const colOffset = start.line === 1 ? offset.start.column : 0;
return {
start: {
...start,