From 710cfcecd30a779a38a1196fd031200ad8a8fe9b Mon Sep 17 00:00:00 2001 From: LemonBoy Date: Fri, 8 Feb 2019 11:57:47 +0100 Subject: Rework exception handling in the VM (#10544) * Rework exception handling in the VM Make the safepoint handling more precise and less forgiving. The new code is clearer and more commented. Perform cleanup on `return`. The no-exception-thrown case in a try block should be slightly faster since we don't parse the whole set of exceptions every time. More tests. * Fix silly error that broke a few tests * Testament doesn't like files having the same name * Remove test case that failed compilation to js --- tests/vm/tmisc_vm.nim | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'tests/vm/tmisc_vm.nim') diff --git a/tests/vm/tmisc_vm.nim b/tests/vm/tmisc_vm.nim index 6eb3dd627..bce0159ce 100644 --- a/tests/vm/tmisc_vm.nim +++ b/tests/vm/tmisc_vm.nim @@ -49,3 +49,23 @@ static: echo "caught Defect" except ValueError: echo "caught ValueError" + +# bug #10538 + +block: + proc fun1(): seq[int] = + try: + try: + result.add(1) + return + except: + result.add(-1) + finally: + result.add(2) + finally: + result.add(3) + result.add(4) + + let x1 = fun1() + const x2 = fun1() + doAssert(x1 == x2) -- cgit 1.4.1-2-gfad0 tests/misc/tnewuns.nim?h=devel'>log tree commit diff stats
path: root/tests/misc/tnewuns.nim
blob: 267c73f5b4f58f643585bca41f622bcc58583e4e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12