test for empty catch block

This commit is contained in:
Volker Berlin 2020-04-10 21:27:29 +02:00
parent 06fc9dddfd
commit 2f1c0f0706

View File

@ -46,6 +46,7 @@ public class Exceptions extends AbstractBaseTest {
addParam( list, script, "rethrow" ); addParam( list, script, "rethrow" );
addParam( list, script, "tryFinally" ); addParam( list, script, "tryFinally" );
addParam( list, script, "complex" ); addParam( list, script, "complex" );
addParam( list, script, "emptyCatch" );
} }
rule.setTestParameters( list ); rule.setTestParameters( list );
rule.setProperty( JWebAssembly.WASM_USE_EH, "true" ); rule.setProperty( JWebAssembly.WASM_USE_EH, "true" );
@ -132,6 +133,17 @@ public class Exceptions extends AbstractBaseTest {
return v; return v;
} }
@Export
static int emptyCatch() {
int h = 127; // variable slot 0
try {
int i = h + 1; // variable slot 1
} catch( NumberFormatException nfe ) { // reuse variable slot 1
// nothing
}
return h;
}
// @Export // @Export
// static int multiCatch() { // static int multiCatch() {
// int r; // int r;