Changes in / [926341c:79dbb79]


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ControlStruct/ExceptTranslate.cc

    r926341c r79dbb79  
    1010// Created On       : Wed Jun 14 16:49:00 2017
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Fri Jul 28 15:34:00 2017
    13 // Update Count     : 6
     12// Last Modified On : Fri Jul 28 14:03:00 2017
     13// Update Count     : 5
    1414//
    1515
     
    224224                        CompoundStmt * block = new CompoundStmt( noLabels );
    225225
    226                         // Just copy the exception value. (Post Validation)
     226                        // Just copy the exception value.
     227                        // TODO: Or just store an ObjectDecl?
    227228                        ObjectDecl * handler_decl =
    228                                 static_cast<ObjectDecl *>( handler->get_decl() );
     229                                dynamic_cast<ObjectDecl*>( handler->get_decl() );
     230                        assert( handler_decl );
    229231                        ObjectDecl * local_except = handler_decl->clone();
    230232                        local_except->set_init(
     
    240242
    241243                        // Save a cast copy of the exception (should always succeed).
    242                         local_except->set_init(
     244                        ObjectDecl * local_except = handler->get_decl()->clone();
     245                        local_except.set_init(
    243246                                new ListInit({ new SingleInit(
    244247                                        new VirtualCastExpr( nameOf( except_obj ),
    245248                                                local_except->get_type()
    246249                                                )
    247                                         ) })
    248                                 );
     250                                        ) }) );
    249251#endif
    250252                        block->push_back( new DeclStmt( noLabels, local_except ) );
     
    586588                catchStmt->set_decl( tmp );
    587589
    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.
    600590                GuardValue( cur_context );
    601591                if ( CatchStmt::Terminate == catchStmt->get_kind() ) {
     
    603593
    604594                        GuardValue( handler_except_decl );
    605                         handler_except_decl = decl;
     595                        handler_except_decl = tmp;
     596                        //handler_except_decl = catchStmt->get_decl();
    606597                } else {
    607598                        cur_context = ResHandler;
Note: See TracChangeset for help on using the changeset viewer.