Ignore:
Timestamp:
May 7, 2020, 11:25:15 AM (3 years ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
arm-eh, 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/conditional.cfa

    rd6566c1 re68d092  
    44// up the non-trivial exception is reasonable to do.
    55
    6 #include "except-mac.hfa"
     6#include <exception.hfa>
    77#include <stdio.h>
    88
    9 DECLARE_EXCEPT(num_error, BASE_EXCEPT,
     9VTABLE_DECLARATION(num_error)(
    1010        int (*code)(num_error *this);
    1111);
     
    3636    this.num = other.num;
    3737}
    38 void copy(num_error * this, num_error * other) {
    39         *this = *other;
    40 }
    4138void ^?{}(num_error & this) {
    4239    if( this.msg ) free( this.msg );
     
    4643}
    4744
    48 VTABLE_INSTANCE(num_error, BASE_EXCEPT, copy, ^?{},
    49         num_error_msg, num_error_code
     45VTABLE_INSTANCE(num_error)(
     46        num_error_msg,
     47        num_error_code,
    5048);
    5149
     
    5856
    5957        try {
    60                 THROW(&exc);
     58                throw &exc;
    6159        } catch (num_error * error ; 3 == error->virtual_table->code( error )) {
    6260                caught_num_error(3, error);
     
    6664
    6765        try {
    68                 THROW_RESUME(&exc);
     66                throwResume &exc;
    6967        } catchResume (num_error * error ; 3 == error->virtual_table->code( error )) {
    7068                caught_num_error(3, error);
Note: See TracChangeset for help on using the changeset viewer.