Wasm: fix issues when building with debugging information and optimizations enabled

This commit is contained in:
Alexey Andreev 2022-12-20 18:01:38 +01:00
parent 9a9e7561b7
commit 013ba237b0

View File

@ -985,7 +985,7 @@ class WasmBinaryRenderingVisitor implements WasmExpressionVisitor {
private void doEmitLocation() { private void doEmitLocation() {
var address = positionToEmit + addressOffset; var address = positionToEmit + addressOffset;
if (dwarfGenerator != null) { if (dwarfGenerator != null) {
if (textLocationToEmit == null) { if (textLocationToEmit == null || textLocationToEmit.getFileName() == null) {
dwarfGenerator.endLineNumberSequence(address); dwarfGenerator.endLineNumberSequence(address);
} else { } else {
dwarfGenerator.lineNumber(address, textLocationToEmit.getFileName(), textLocationToEmit.getLine()); dwarfGenerator.lineNumber(address, textLocationToEmit.getFileName(), textLocationToEmit.getLine());
@ -1010,7 +1010,7 @@ class WasmBinaryRenderingVisitor implements WasmExpressionVisitor {
methodStack.remove(methodStack.size() - 1); methodStack.remove(methodStack.size() - 1);
} }
while (commonPart < currentMethodStack.size()) { while (commonPart < currentMethodStack.size()) {
var method = currentMethodStack.get(commonPart); var method = currentMethodStack.get(commonPart++);
methodStack.add(method); methodStack.add(method);
debugLines.start(method); debugLines.start(method);
} }