Ignore:
Timestamp:
May 7, 2020, 11:25:15 AM (4 years ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
8e16177, af7acb9
Parents:
d6566c1
Message:

Replaced my exception patch macros with a (hopefully temporary) addition to the standard libary, the same macros just cleaned up. See the exception tests for some example uses.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/exceptions/terminate.cfa

    rd6566c1 re68d092  
    11// Termination Exception Tests
    22
    3 #include "except-mac.hfa"
     3#include <exception.hfa>
    44#include "except-io.hfa"
    55
     
    1414                loud_exit a = "simple try clause";
    1515                printf("simple throw\n");
    16                 THROW(&(zen){});
     16                throw &(zen){};
    1717                printf("end of try clause\n");
    1818        } catch (zen * error) {
     
    2525        try {
    2626                printf("throwing child exception\n");
    27                 THROW(&(moment_of){});
     27                throw &(moment_of){};
    2828        } catch (zen *) {
    2929                printf("inner parent match\n");
     
    3636        try {
    3737                try {
    38                         THROW(&(yin){});
     38                        throw &(yin){};
    3939                } catch (zen *) {
    4040                        printf("caught yin as zen\n");
     
    5252                        loud_exit a = "rethrow inner try";
    5353                        printf("rethrow inner try\n");
    54                         THROW(&(zen){});
     54                        throw &(zen){};
    5555                } catch (zen *) {
    5656                        loud_exit a = "rethrowing catch clause";
     
    6767        try {
    6868                try {
    69                         THROW(&(yin){});
     69                        throw &(yin){};
    7070                } catch (yin *) {
    7171                        printf("caught yin, will throw yang\n");
    72                         THROW(&(yang){});
     72                        throw &(yang){};
    7373                } catch (yang *) {
    7474                        printf("caught exception from same try\n");
     
    8383                try {
    8484                        printf("throwing first exception\n");
    85                         THROW(&(yin){});
     85                        throw &(yin){};
    8686                } catch (yin *) {
    8787                        printf("caught first exception\n");
    8888                        try {
    8989                                printf("throwing second exception\n");
    90                                 THROW(&(yang){});
     90                                throw &(yang){};
    9191                        } catch (yang *) {
    9292                                printf("caught second exception\n");
     
    104104        try {
    105105                try {
    106                         THROW(&(zen){});
    107                         THROW(&(zen){});
     106                        throw &(zen){};
     107                        throw &(zen){};
    108108                } catch (zen *) {
    109109                        printf("inner catch\n");
    110110                }
    111                 THROW(&(zen){});
     111                throw &(zen){};
    112112        } catch (zen *) {
    113113                printf("outer catch\n");
Note: See TracChangeset for help on using the changeset viewer.