Skip to content

Commit

Permalink
The source map lines are not zero based. Lines are one based. fix #6
Browse files Browse the repository at this point in the history
  • Loading branch information
Horcrux7 committed Apr 1, 2019
1 parent 47430b3 commit 3ba7b44
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 3ba7b44

Please sign in to comment.