From 9570cc45f1126fd60184abb534189e381be41b5e Mon Sep 17 00:00:00 2001 From: Asumu Takikawa Date: Fri, 27 Sep 2024 17:00:45 -0700 Subject: [PATCH] Index map algorithm: fix generatedColumn on lines after the first --- source-map.bs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source-map.bs b/source-map.bs index 058f641..ad374fc 100644 --- a/source-map.bs +++ b/source-map.bs @@ -729,10 +729,13 @@ To decode an index source map given a [=string=]-keyed [=/map= 1. If the previous step reported an error, [=optionally report an error=] and continue with the next iteration. 1. Set |sourceMap|'s [=decoded source map/sources=] to the result of [=list/extending=] |sourceMap|'s [=decoded source map/sources=] with |decodedSection|'s [=decoded source map/sources=]. 1. Let |offsetMappings| be a new [=list=]. + 1. Let |firstLine| be null. 1. [=For each=] |mapping| of |decodedSection|'s [=decoded source map/mappings=]: 1. Let |offsetMapping| be a new [=decoded mapping=]. 1. Set |offsetMapping|'s [=decoded mapping/generatedLine=] to |mapping|'s [=decoded mapping/generatedLine=] + |offsetLine|. - 1. Set |offsetMapping|'s [=decoded mapping/generatedColumn=] to |mapping|'s [=decoded mapping/generatedColumn=] + |offsetColumn|. + 1. If |firstLine| is null, set |firstLine| to |offsetMapping|'s [=decoded mapping/generatedLine=]. + 1. If |offsetMapping|'s [=decoded mapping/generatedLine=] is equal to |firstLine|, set |offsetMapping|'s [=decoded mapping/generatedColumn=] to |mapping|'s [=decoded mapping/generatedColumn=] + |offsetColumn|. + 1. Otherwise, set |offsetMapping|'s [=decoded mapping/generatedColumn=] to |mapping|'s [=decoded mapping/generatedColumn=]. 1. Set |offsetMapping|'s [=decoded mapping/originalSource=] to |mapping|'s [=decoded mapping/originalSource=]. 1. Set |offsetMapping|'s [=decoded mapping/originalLine=] to |mapping|'s [=decoded mapping/originalLine=]. 1. Set |offsetMapping|'s [=decoded mapping/originalColumn=] to |mapping|'s [=decoded mapping/originalColumn=].