Changeset 8fc9a5f


Ignore:
Timestamp:
Oct 8, 2020, 4:46:16 PM (4 years ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
40a1392, b3f9684c
Parents:
8e4bc30
Message:

Did some work the exception header to better fake associated types.

Location:
libcfa/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/concurrency/coroutine.hfa

    r8e4bc30 r8fc9a5f  
    3737// Anything that implements this trait can be resumed.
    3838// Anything that is resumed is a coroutine.
    39 trait is_coroutine(dtype T
    40                 | is_resumption_exception(CoroutineCancelled(T),
    41                         CoroutineCancelled_vtable(T))) {
     39trait is_coroutine(dtype T | IS_RESUMPTION_EXCEPTION(CoroutineCancelled, (T))) {
    4240        void main(T & this);
    4341        $coroutine * get_coroutine(T & this);
  • libcfa/src/exception.hfa

    r8e4bc30 r8fc9a5f  
    125125#define VTABLE_ASSERTION(exception_name, parameters) \
    126126        { VTABLE_TYPE(exception_name) parameters VTABLE_NAME(exception_name); }
     127
     128// IS_EXCEPTION(exception_name [, (...parameters)])
     129// IS_RESUMPTION_EXCEPTION(exception_name [, (parameters...)])
     130// IS_TERMINATION_EXCEPTION(exception_name [, (parameters...)])
     131// Create an assertion that exception_name, possibly with the qualifing parameters, is the given
     132// kind of exception with the standard vtable with the same parameters if applicable.
     133#define IS_EXCEPTION(...) _IS_EXCEPTION(is_exception, __VA_ARGS__, , ~)
     134#define IS_RESUMPTION_EXCEPTION(...) _IS_EXCEPTION(is_resumption_exception, __VA_ARGS__, , ~)
     135#define IS_TERMINATION_EXCEPTION(...) _IS_EXCEPTION(is_termination_exception, __VA_ARGS__, , ~)
    127136
    128137// All internal helper macros begin with an underscore.
     
    234243                _GLUE2(exception_name,_copy), ^?{}, \
    235244                _CLOSE
     245
     246#define _IS_EXCEPTION(kind, exception_name, parameters, ...) \
     247        kind(exception_name parameters, VTABLE_TYPE(exception_name) parameters)
Note: See TracChangeset for help on using the changeset viewer.