prevent empty ELSE branches

This commit is contained in:
Volker Berlin 2022-04-24 18:18:29 +02:00
parent 2f8538dbf5
commit 4b2b65e883

View File

@ -563,8 +563,13 @@ class BranchManager {
endPos = branch.endPos;
} else {
branch.elseEndPos = endPos;
branch = new BranchNode( positions.elsePos, endPos, WasmBlockOperator.ELSE, WasmBlockOperator.END );
parent.add( branch );
if( positions.elsePos == endPos ) {
// we does not need an empty else branch
branch.endOp = WasmBlockOperator.END;
} else {
branch = new BranchNode( positions.elsePos, endPos, WasmBlockOperator.ELSE, WasmBlockOperator.END );
parent.add( branch );
}
}
break;
}