Changeset 42a02ce for src


Ignore:
Timestamp:
Aug 3, 2021, 10:47:45 AM (3 years ago)
Author:
Henry Xue <y58xue@…>
Branches:
ADT, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
da602aec
Parents:
fa7dbf1
git-author:
Henry Xue <y58xue@…> (08/03/21 10:07:08)
git-committer:
Henry Xue <y58xue@…> (08/03/21 10:47:45)
Message:

Fix virtual cast error not showing code locations

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ControlStruct/ExceptTranslate.cc

    rfa7dbf1 r42a02ce  
    99// Author           : Andrew Beach
    1010// Created On       : Wed Jun 14 16:49:00 2017
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Wed Jun 24 11:18:00 2020
    13 // Update Count     : 17
     11// Last Modified By : Henry Xue
     12// Last Modified On : Tue Aug 03 10:05:51 2021
     13// Update Count     : 18
    1414//
    1515
     
    320320                                static_cast<ObjectDecl *>( handler->get_decl() );
    321321                        ObjectDecl * local_except = handler_decl->clone();
    322                         local_except->set_init(
    323                                 new ListInit({ new SingleInit(
    324                                         new VirtualCastExpr( nameOf( except_obj ),
    325                                                 local_except->get_type()
    326                                                 )
    327                                         ) })
     322                        VirtualCastExpr * vcex = new VirtualCastExpr(
     323                                nameOf( except_obj ),
     324                                local_except->get_type()
    328325                                );
     326                        vcex->location = handler->location;
     327                        local_except->set_init( new ListInit({ new SingleInit( vcex ) }) );
    329328                        block->push_back( new DeclStmt( local_except ) );
    330329
     
    392391
    393392                // Check for type match.
    394                 Expression * cond = UntypedExpr::createAssign( nameOf( local_except ),
    395                         new VirtualCastExpr( nameOf( except_obj ),
    396                                 local_except->get_type()->clone() ) );
     393                VirtualCastExpr * vcex = new VirtualCastExpr(
     394                        nameOf( except_obj ),
     395                        local_except->get_type()->clone()
     396                        );
     397                vcex->location = modded_handler->location;
     398                Expression * cond = UntypedExpr::createAssign(
     399                        nameOf( local_except ), vcex );
    397400
    398401                // Add the check on the conditional if it is provided.
Note: See TracChangeset for help on using the changeset viewer.