ADT
ast-experimental
enum
forall-pointer-decay
jacob/cs343-translation
new-ast-unique-expr
pthread-emulation
qualifiedEnum
Last change
on this file since 42a02ce was ecfd758, checked in by Andrew Beach <ajbeach@…>, 4 years ago |
Major exception update, seperating type-ids from virtual tables. The major interface changes are done. There is a regression of ?Cancelled(T) to Some?Cancelled. There is some bits of code for the new verion of the ?Cancelled(T) interface already there. Not connected yet but I just reached the limit of what I wanted to do in one commit and then spent over a day cleaning up, so it will replace Some?Cancelled in a future commit.
|
-
Property mode
set to
100644
|
File size:
1.2 KB
|
Line | |
---|
1 | // Finally Clause Tests
|
---|
2 |
|
---|
3 | #include <exception.hfa>
|
---|
4 | #include "except-io.hfa"
|
---|
5 |
|
---|
6 | EHM_EXCEPTION(myth)();
|
---|
7 |
|
---|
8 | EHM_VIRTUAL_TABLE(myth, myth_vt);
|
---|
9 |
|
---|
10 | int main(int argc, char * argv[]) {
|
---|
11 | myth exc = {&myth_vt};
|
---|
12 |
|
---|
13 | try {
|
---|
14 | try {
|
---|
15 | printf("termination throw\n");
|
---|
16 | throw exc;
|
---|
17 | } finally {
|
---|
18 | loud_exit a = "termination inner finally";
|
---|
19 | printf("finally during unwind\n");
|
---|
20 | }
|
---|
21 | } catch (myth * error) {
|
---|
22 | printf("termination catch\n");
|
---|
23 | } finally {
|
---|
24 | loud_exit a = "termination outer finally";
|
---|
25 | printf("finally after catch\n");
|
---|
26 | }
|
---|
27 | printf("\n");
|
---|
28 |
|
---|
29 | try {
|
---|
30 | try {
|
---|
31 | printf("resumption throw\n");
|
---|
32 | throwResume exc;
|
---|
33 | } finally {
|
---|
34 | loud_exit a = "resumption inner finally";
|
---|
35 | printf("finally after resume\n");
|
---|
36 | }
|
---|
37 | } catchResume (myth * error) {
|
---|
38 | printf("resumption catch\n");
|
---|
39 | } finally {
|
---|
40 | loud_exit a = "resumption outer finally";
|
---|
41 | printf("finally after catch\n");
|
---|
42 | }
|
---|
43 | printf("\n");
|
---|
44 |
|
---|
45 | try {
|
---|
46 | printf("walking out of try\n");
|
---|
47 | } finally {
|
---|
48 | loud_exit a = "walking finally";
|
---|
49 | printf("walking through finally\n");
|
---|
50 | }
|
---|
51 | printf("\n");
|
---|
52 |
|
---|
53 | try {
|
---|
54 | printf("jumping out of try\n");
|
---|
55 | goto endoffunction;
|
---|
56 | } finally {
|
---|
57 | loud_exit a = "jumping finally";
|
---|
58 | printf("jumping through finally\n");
|
---|
59 | }
|
---|
60 | endoffunction:
|
---|
61 | ;
|
---|
62 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.