ADTast-experimentalenumforall-pointer-decayjacob/cs343-translationnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change
on this file since acb38ce9 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
|
Rev | Line | |
---|
[6d43cdde] | 1 | // Finally Clause Tests |
---|
| 2 | |
---|
[e68d092] | 3 | #include <exception.hfa> |
---|
[6d43cdde] | 4 | #include "except-io.hfa" |
---|
| 5 | |
---|
[ecfd758] | 6 | EHM_EXCEPTION(myth)(); |
---|
| 7 | |
---|
| 8 | EHM_VIRTUAL_TABLE(myth, myth_vt); |
---|
[6d43cdde] | 9 | |
---|
| 10 | int main(int argc, char * argv[]) { |
---|
[ecfd758] | 11 | myth exc = {&myth_vt}; |
---|
[6d43cdde] | 12 | |
---|
| 13 | try { |
---|
| 14 | try { |
---|
| 15 | printf("termination throw\n"); |
---|
[046a890] | 16 | throw exc; |
---|
[6d43cdde] | 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"); |
---|
[046a890] | 32 | throwResume exc; |
---|
[6d43cdde] | 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.