From fd5ac5898c61b6b269a1770b54de720df4ca6e66 Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Mon, 21 Feb 2022 01:19:57 +0100 Subject: [PATCH] make offset pure --- strudel.mjs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/strudel.mjs b/strudel.mjs index 0201e721..5c5ad1c4 100644 --- a/strudel.mjs +++ b/strudel.mjs @@ -874,14 +874,11 @@ Pattern.prototype.bootstrap = () => { // this is wrapped around mini patterns to offset krill parser location into the global js code space function withLocationOffset(pat, offset) { - // console.log('with offfset',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,