summaryrefslogtreecommitdiff
path: root/test/binaryen.js/exception-handling.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/binaryen.js/exception-handling.js')
-rw-r--r--test/binaryen.js/exception-handling.js40
1 files changed, 35 insertions, 5 deletions
diff --git a/test/binaryen.js/exception-handling.js b/test/binaryen.js/exception-handling.js
index e6cadcf88..40dc9d489 100644
--- a/test/binaryen.js/exception-handling.js
+++ b/test/binaryen.js/exception-handling.js
@@ -3,7 +3,8 @@ function cleanInfo(info) {
for (var x in info) {
// Filter out address pointers and only print meaningful info
if (x == 'id' || x == 'type' || x == 'name' || x == 'event' ||
- x == 'depth' || x == 'hasCatchAll') {
+ x == 'depth' || x == 'hasCatchAll' || x == 'delegateTarget' ||
+ x == 'isDelegate') {
ret[x] = info[x];
}
}
@@ -31,7 +32,8 @@ var event_ = module.addEvent("e", 0, binaryen.i32, binaryen.none);
// )
var throw_ = module.throw("e", [module.i32.const(0)]);
var rethrow = module.rethrow(0);
-var try_ = module.try(
+var try_catch = module.try(
+ '',
throw_,
["e"],
[
@@ -42,14 +44,42 @@ var try_ = module.try(
],
binaryen.none
)
- ]
+ ],
+ ''
);
-var func = module.addFunction("test", binaryen.none, binaryen.none, [], try_);
+// (try $try_outer
+// (do
+// (try
+// (do
+// (throw $a-event (i32.const 0))
+// )
+// (delegate $try_outer)
+// )
+// )
+// (catch_all)
+// )
+var try_delegate = module.try(
+ 'try_outer',
+ module.try(
+ '',
+ throw_,
+ [],
+ [],
+ 'try_outer'
+ ),
+ [],
+ [module.nop()],
+ ''
+);
+
+var body = module.block('', [try_catch, try_delegate])
+var func = module.addFunction("test", binaryen.none, binaryen.none, [], body);
console.log(module.emitText());
assert(module.validate());
console.log("getExpressionInfo(throw) = " + stringify(throw_));
console.log("getExpressionInfo(rethrow) = " + stringify(rethrow));
-console.log("getExpressionInfo(try) = " + stringify(try_));
+console.log("getExpressionInfo(try_catch) = " + stringify(try_catch));
+console.log("getExpressionInfo(try_delegate) = " + stringify(try_delegate));