From 3ba7b44089fd523e53fb5dd0d26b21d69d604602 Mon Sep 17 00:00:00 2001 From: Volker Berlin Date: Mon, 1 Apr 2019 20:35:20 +0200 Subject: [PATCH] The source map lines are not zero based. Lines are one based. fix #6 --- src/de/inetsoftware/jwebassembly/sourcemap/SourceMapWriter.java | 2 +- src/de/inetsoftware/jwebassembly/sourcemap/SourceMapping.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/de/inetsoftware/jwebassembly/sourcemap/SourceMapWriter.java b/src/de/inetsoftware/jwebassembly/sourcemap/SourceMapWriter.java index ce73646e..ac788451 100644 --- a/src/de/inetsoftware/jwebassembly/sourcemap/SourceMapWriter.java +++ b/src/de/inetsoftware/jwebassembly/sourcemap/SourceMapWriter.java @@ -188,7 +188,7 @@ private class Generator { void appendLineMappings() throws IOException { out.append( '\"' ); for( SourceMapping mapping : mappings ) { - int generatedLine = 1; // ever 1 for WebAssembly + int generatedLine = 0; // ever 1 for WebAssembly but line one is coded as zero int generatedColumn = mapping.getGeneratedColumn(); if( generatedLine > 0 && previousLine != generatedLine ) { diff --git a/src/de/inetsoftware/jwebassembly/sourcemap/SourceMapping.java b/src/de/inetsoftware/jwebassembly/sourcemap/SourceMapping.java index 1fcd0bb1..adcea847 100644 --- a/src/de/inetsoftware/jwebassembly/sourcemap/SourceMapping.java +++ b/src/de/inetsoftware/jwebassembly/sourcemap/SourceMapping.java @@ -37,7 +37,7 @@ public class SourceMapping { */ public SourceMapping( int generatedColumn, int sourceLine, String sourceFileName ) { this.generatedColumn = generatedColumn; - this.sourceLine = sourceLine; + this.sourceLine = sourceLine - 1; // The first line is coded as zero this.sourceFileName = sourceFileName; }