Changeset 523e300 for src/ControlStruct


Ignore:
Timestamp:
Dec 20, 2023, 4:21:09 PM (4 months ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
master
Children:
c7ebbec
Parents:
0a6d2045
Message:

Forgot to remove an unused function from the exception code.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ControlStruct/ExceptTranslate.cpp

    r0a6d2045 r523e300  
    147147        ast::CaseClause * create_terminate_catch_case(
    148148                const ast::DeclWithType * except_obj, int index, ast::CatchClause * clause );
    149         ast::FunctionDecl * create_terminate_catch( CatchList &handlers );
    150149        ast::CompoundStmt * create_single_matcher(
    151150                const ast::DeclWithType * except_obj, ast::CatchClause * modded_handler );
     
    299298                                ast::Label( location ) ),
    300299                }
    301         );
    302 }
    303 
    304 ast::FunctionDecl * TryMutatorCore::create_terminate_catch(
    305                 CatchList &handlers ) {
    306         // void catch(int index, exception * except) {
    307         //     switch (index) { CATCH_CASE... }
    308         // }
    309 
    310         assert( !handlers.empty() );
    311         std::vector<ast::ptr<ast::CaseClause>> handler_wrappers;
    312         const CodeLocation & location = handlers.front()->location;
    313 
    314         const ast::DeclWithType * index_obj = make_index_object( location );
    315         const ast::DeclWithType * except_obj = make_exception_object( location );
    316 
    317         // Index 1..{number of handlers}
    318         for ( const auto & [index, handler] : enumerate( handlers ) ) {
    319                 handler_wrappers.push_back(
    320                         create_terminate_catch_case( except_obj, index + 1, handler ) );
    321         }
    322         // TODO: Some sort of meaningful error on default perhaps?
    323 
    324         ast::SwitchStmt * handler_lookup = new ast::SwitchStmt( location,
    325                 new ast::VariableExpr( location, index_obj ),
    326                 std::move(handler_wrappers)
    327                 );
    328         ast::CompoundStmt * body = new ast::CompoundStmt( location, {handler_lookup} );
    329 
    330         // void (*catch)(int, exception_t *) `body`
    331         return new ast::FunctionDecl(
    332                 location,
    333                 "catch",
    334                 { index_obj, except_obj },
    335                 {}, //return void
    336                 body,
    337                 ast::Storage::Classes{},
    338                 ast::Linkage::Cforall
    339300        );
    340301}
Note: See TracChangeset for help on using the changeset viewer.