Fix missing END of TRY CATCH with RETURN in CATCH block.

This commit is contained in:
Volker Berlin 2019-02-23 14:59:43 +01:00
parent abb6c8a38a
commit 09a9e66e42
2 changed files with 9 additions and 3 deletions

View File

@ -25,6 +25,7 @@ import java.util.List;
import javax.annotation.Nonnull;
import de.inetsoftware.classparser.Code;
import de.inetsoftware.classparser.CodeInputStream;
import de.inetsoftware.classparser.TryCatchFinally;
import de.inetsoftware.jwebassembly.WasmException;
@ -61,11 +62,16 @@ class BranchManger {
/**
* Remove all branch information for reusing the manager.
*
* @param code
* the Java method code
*/
void reset( TryCatchFinally[] exceptionTable ) {
void reset( @Nonnull Code code ) {
allParsedOperations.clear();
root.clear();
loops.clear();
root.endPos = code.getCodeSize();
TryCatchFinally[] exceptionTable = code.getExceptionTable();
for( TryCatchFinally ex : exceptionTable ) {
allParsedOperations.add( new TryCatchParsedBlock( ex ) );
}
@ -753,7 +759,7 @@ class BranchManger {
private final int startPos;
private final int endPos;
private int endPos;
private final WasmBlockOperator startOp;

View File

@ -56,7 +56,7 @@ class JavaMethodWasmCodeBuilder extends WasmCodeBuilder {
CodeInputStream byteCode = null;
try {
reset();
branchManager.reset( code.getExceptionTable() );
branchManager.reset( code );
byteCode = code.getByteCode();
writeCode( byteCode, code.getConstantPool(), hasReturn );