From 2f1c0f070654ecf55d95be79fae741bef1140952 Mon Sep 17 00:00:00 2001 From: Volker Berlin Date: Fri, 10 Apr 2020 21:27:29 +0200 Subject: [PATCH] test for empty catch block --- .../jwebassembly/runtime/Exceptions.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/de/inetsoftware/jwebassembly/runtime/Exceptions.java b/test/de/inetsoftware/jwebassembly/runtime/Exceptions.java index 354157d..2f8d6b0 100644 --- a/test/de/inetsoftware/jwebassembly/runtime/Exceptions.java +++ b/test/de/inetsoftware/jwebassembly/runtime/Exceptions.java @@ -46,6 +46,7 @@ public class Exceptions extends AbstractBaseTest { addParam( list, script, "rethrow" ); addParam( list, script, "tryFinally" ); addParam( list, script, "complex" ); + addParam( list, script, "emptyCatch" ); } rule.setTestParameters( list ); rule.setProperty( JWebAssembly.WASM_USE_EH, "true" ); @@ -132,6 +133,17 @@ public class Exceptions extends AbstractBaseTest { 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 // static int multiCatch() { // int r;