Changes in / [79dbb79:926341c]


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ControlStruct/ExceptTranslate.cc

    r79dbb79 r926341c  
    1010// Created On       : Wed Jun 14 16:49:00 2017
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Fri Jul 28 14:03:00 2017
    13 // Update Count     : 5
     12// Last Modified On : Fri Jul 28 15:34:00 2017
     13// Update Count     : 6
    1414//
    1515
     
    224224                        CompoundStmt * block = new CompoundStmt( noLabels );
    225225
    226                         // Just copy the exception value.
    227                         // TODO: Or just store an ObjectDecl?
     226                        // Just copy the exception value. (Post Validation)
    228227                        ObjectDecl * handler_decl =
    229                                 dynamic_cast<ObjectDecl*>( handler->get_decl() );
    230                         assert( handler_decl );
     228                                static_cast<ObjectDecl *>( handler->get_decl() );
    231229                        ObjectDecl * local_except = handler_decl->clone();
    232230                        local_except->set_init(
     
    242240
    243241                        // Save a cast copy of the exception (should always succeed).
    244                         ObjectDecl * local_except = handler->get_decl()->clone();
    245                         local_except.set_init(
     242                        local_except->set_init(
    246243                                new ListInit({ new SingleInit(
    247244                                        new VirtualCastExpr( nameOf( except_obj ),
    248245                                                local_except->get_type()
    249246                                                )
    250                                         ) }) );
     247                                        ) })
     248                                );
    251249#endif
    252250                        block->push_back( new DeclStmt( noLabels, local_except ) );
     
    588586                catchStmt->set_decl( tmp );
    589587
     588                // Validate the Statement's form.
     589                ObjectDecl * decl =
     590                        dynamic_cast<ObjectDecl *>( catchStmt->get_decl() );
     591                if ( decl && true /* check decl->get_type() */ ) {
     592                        // Pass.
     593                } else if ( CatchStmt::Terminate == catchStmt->get_kind() ) {
     594                        throw SemanticError("catch must have exception type");
     595                } else {
     596                        throw SemanticError("catchResume must have exception type");
     597                }
     598
     599                // Track the handler context.
    590600                GuardValue( cur_context );
    591601                if ( CatchStmt::Terminate == catchStmt->get_kind() ) {
     
    593603
    594604                        GuardValue( handler_except_decl );
    595                         handler_except_decl = tmp;
    596                         //handler_except_decl = catchStmt->get_decl();
     605                        handler_except_decl = decl;
    597606                } else {
    598607                        cur_context = ResHandler;
Note: See TracChangeset for help on using the changeset viewer.