Changeset fe63ae6 for tests/exceptions/resume.cfa
- Timestamp:
- Apr 12, 2021, 5:16:45 PM (3 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- a1b9bc3
- Parents:
- 56c8b86 (diff), 73f4d08 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/exceptions/resume.cfa
r56c8b86 rfe63ae6 4 4 #include "except-io.hfa" 5 5 6 TRIVIAL_EXCEPTION(yin); 7 TRIVIAL_EXCEPTION(yang); 8 TRIVIAL_EXCEPTION(zen); 9 TRIVIAL_EXCEPTION(moment_of, zen); 6 EHM_EXCEPTION(yin)(); 7 EHM_EXCEPTION(yang)(); 8 EHM_EXCEPTION(zen)(); 9 10 EHM_VIRTUAL_TABLE(yin, yin_vt); 11 EHM_VIRTUAL_TABLE(yang, yang_vt); 12 EHM_VIRTUAL_TABLE(zen, zen_vt); 10 13 11 14 void in_void(void); 12 15 13 16 int main(int argc, char * argv[]) { 17 yin a_yin = {&yin_vt}; 18 yang a_yang = {&yang_vt}; 19 zen a_zen = {&zen_vt}; 20 14 21 // The simple throw catchResume test. 15 22 try { 16 23 loud_exit a = "simple try clause"; 17 24 printf("simple throw\n"); 18 throwResume (zen){};25 throwResume a_zen; 19 26 printf("end of try clause\n"); 20 27 } catchResume (zen * error) { … … 26 33 // Throw catch-all test. 27 34 try { 28 throwResume (zen){};35 throwResume a_zen; 29 36 } catchResume (exception_t * error) { 30 37 printf("catch-all\n"); 31 }32 printf("\n");33 34 // Catch a parent of the given exception.35 try {36 printf("throwing child exception\n");37 throwResume (moment_of){};38 } catchResume (zen *) {39 printf("inner parent match\n");40 } catchResume (moment_of *) {41 printf("outer exact match\n");42 38 } 43 39 printf("\n"); … … 46 42 try { 47 43 try { 48 throwResume (yin){};44 throwResume a_yin; 49 45 } catchResume (zen *) { 50 46 printf("caught yin as zen\n"); … … 62 58 loud_exit a = "rethrow inner try"; 63 59 printf("rethrow inner try\n"); 64 throwResume (zen){};60 throwResume a_zen; 65 61 } catchResume (zen *) { 66 62 loud_exit a = "rethrowing catch clause"; … … 77 73 try { 78 74 try { 79 throwResume (yin){};75 throwResume a_yin; 80 76 } catchResume (yin *) { 81 77 printf("caught yin, will throw yang\n"); 82 throwResume (yang){};78 throwResume a_yang; 83 79 } catchResume (yang *) { 84 80 printf("caught exception from same try\n"); … … 93 89 try { 94 90 printf("throwing first exception\n"); 95 throwResume (yin){};91 throwResume a_yin; 96 92 } catchResume (yin *) { 97 93 printf("caught first exception\n"); 98 94 try { 99 95 printf("throwing second exception\n"); 100 throwResume (yang){};96 throwResume a_yang; 101 97 } catchResume (yang *) { 102 98 printf("caught second exception\n"); … … 114 110 try { 115 111 try { 116 throwResume (zen){};117 throwResume (zen){};112 throwResume a_zen; 113 throwResume a_zen; 118 114 } catchResume (zen *) { 119 115 printf("inner catch\n"); 120 116 } 121 throwResume (zen){};117 throwResume a_zen; 122 118 } catchResume (zen *) { 123 119 printf("outer catch\n"); … … 130 126 // Do a throw and rethrow in a void function. 131 127 void in_void(void) { 128 zen a_zen = {&zen_vt}; 132 129 try { 133 130 try { 134 131 printf("throw\n"); 135 throwResume (zen){};132 throwResume a_zen; 136 133 } catchResume (zen *) { 137 134 printf("rethrow\n");
Note: See TracChangeset
for help on using the changeset viewer.