Changeset fe63ae6 for tests/exceptions/data-except.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/data-except.cfa
r56c8b86 rfe63ae6 3 3 #include <exception.hfa> 4 4 5 DATA_EXCEPTION(paired)(5 EHM_EXCEPTION(paired)( 6 6 int first; 7 7 int second; 8 8 ); 9 9 10 void ?{}(paired & this, int first, int second) { 11 VTABLE_INIT(this, paired); 12 this.first = first; 13 this.second = second; 14 } 10 EHM_VIRTUAL_TABLE(paired, paired_vt); 15 11 16 const char * paired_msg(paired * this) { 17 return "paired"; 18 } 19 20 VTABLE_INSTANCE(paired)(paired_msg); 21 22 void throwPaired(int first, int second) { 23 paired exc = {first, second}; 12 const char * virtual_msg(paired * this) { 13 return this->virtual_table->msg(this); 24 14 } 25 15 26 16 int main(int argc, char * argv[]) { 27 paired except = { 3, 13};17 paired except = {&paired_vt, 3, 13}; 28 18 29 19 try { 30 20 throw except; 31 21 } catch (paired * exc) { 32 printf("%s(%d, %d)\n", paired_msg(exc), exc->first, exc->second);22 printf("%s(%d, %d)\n", virtual_msg(exc), exc->first, exc->second); 33 23 ++exc->first; 34 24 } 35 25 36 printf("%s(%d, %d)\n", paired_msg(&except), except.first, except.second);26 printf("%s(%d, %d)\n", virtual_msg(&except), except.first, except.second); 37 27 38 28 try { 39 29 throwResume except; 40 30 } catchResume (paired * exc) { 41 printf("%s(%d, %d)\n", paired_msg(exc), exc->first, exc->second);31 printf("%s(%d, %d)\n", virtual_msg(exc), exc->first, exc->second); 42 32 ++exc->first; 43 33 } 44 34 45 printf("%s(%d, %d)\n", paired_msg(&except), except.first, except.second);35 printf("%s(%d, %d)\n", virtual_msg(&except), except.first, except.second); 46 36 }
Note: See TracChangeset
for help on using the changeset viewer.