Fix bug in source map generation

This bug caused metadata lines that follow after the code
generated from Java bytecode, to be mapped to the line in
Java bytecode of the method that appears last in the generated
JavaScript
This commit is contained in:
Alexey Andreev 2018-11-18 02:11:28 +03:00
parent e5c85dd3bd
commit f2dd398719

View File

@ -24,6 +24,7 @@ public class SourceLocationIterator {
private GeneratedLocation location;
private int fileId = -1;
private int line = -1;
private boolean endReached;
SourceLocationIterator(DebugInformation debugInformation) {
this.debugInformation = debugInformation;
@ -33,7 +34,7 @@ public class SourceLocationIterator {
}
public boolean isEndReached() {
return fileIndex >= debugInformation.fileMapping.size() && lineIndex >= debugInformation.lineMapping.size();
return endReached;
}
private void read() {
@ -55,8 +56,10 @@ public class SourceLocationIterator {
nextFileRecord();
} else if (lineIndex < debugInformation.lineMapping.size()) {
nextLineRecord();
} else {
} else if (endReached) {
throw new IllegalStateException("End already reached");
} else {
endReached = true;
}
}