Changeset 142930b for src


Ignore:
Timestamp:
Dec 13, 2023, 4:45:21 PM (8 months ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
master
Children:
21ad568
Parents:
3e49c477
Message:

A harder revert of exception changes, hopefully it will get the tests working.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ControlStruct/ExceptTranslate.cpp

    r3e49c477 r142930b  
    482482                ast::FunctionDecl * terminate_catch,
    483483                ast::FunctionDecl * terminate_match ) {
    484         // {
    485         //     int __handler_index = __cfaehm_try_terminate(`try`, `match`);
    486         //     if ( __handler_index ) {
    487         //         `catch`( __handler_index, __cfaehm_get_current_exception() );
    488         //     }
    489         // }
    490 
    491         ast::ObjectDecl * index = new ast::ObjectDecl( loc, "__handler_index",
    492                 new ast::BasicType( ast::BasicType::SignedInt ),
    493                 new ast::SingleInit( loc,
    494                         new ast::UntypedExpr( loc,
    495                                 new ast::NameExpr( loc, "__cfaehm_try_terminate" ),
    496                                 {
    497                                         new ast::VariableExpr( loc, try_wrapper ),
    498                                         new ast::VariableExpr( loc, terminate_catch ),
    499                                         new ast::VariableExpr( loc, terminate_match ),
    500                                 }
    501                         )
    502                 )
    503         );
    504 
    505         return new ast::CompoundStmt( loc, {
    506                 new ast::DeclStmt( loc, index ),
    507                 new ast::IfStmt( loc,
    508                         new ast::VariableExpr( loc, index ),
    509                         new ast::ExprStmt( loc,
    510                                 new ast::UntypedExpr( loc,
    511                                         new ast::VariableExpr( loc, terminate_catch ),
    512                                         {
    513                                                 new ast::VariableExpr( loc, index ),
    514                                                 new ast::UntypedExpr( loc,
    515                                                         new ast::NameExpr( loc, "__cfaehm_get_current_exception" )
    516                                                 ),
    517                                         }
    518                                 )
    519                         )
    520                 ),
    521         } );
     484        // { __cfaehm_try_terminate(`try`, `catch`, `match`); }
     485
     486        ast::UntypedExpr * caller = new ast::UntypedExpr(loc, new ast::NameExpr(loc,
     487                "__cfaehm_try_terminate" ) );
     488        caller->args.push_back( new ast::VariableExpr(loc, try_wrapper ) );
     489        caller->args.push_back( new ast::VariableExpr(loc, terminate_catch ) );
     490        caller->args.push_back( new ast::VariableExpr(loc, terminate_match ) );
     491
     492        ast::CompoundStmt * callStmt = new ast::CompoundStmt(loc);
     493        callStmt->push_back( new ast::ExprStmt( loc, caller ) );
     494        return callStmt;
    522495}
    523496
Note: See TracChangeset for help on using the changeset viewer.