Changeset b2de2e0


Ignore:
Timestamp:
May 26, 2020, 11:24:55 AM (4 years ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
c19bc90
Parents:
c1dfa4e
Message:

Improved the check of the catch[Resume] exception declaration.

Files:
2 added
1 edited

Legend:

Unmodified
Added
Removed
  • src/ControlStruct/ExceptTranslate.cc

    rc1dfa4e rb2de2e0  
    1010// Created On       : Wed Jun 14 16:49:00 2017
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Thr May 21 13:18:00 2020
    13 // Update Count     : 15
     12// Last Modified On : Tue May 26 10:56:00 2020
     13// Update Count     : 16
    1414//
    1515
     
    134134                ObjectDecl * decl = dynamic_cast<ObjectDecl *>( catchStmt->get_decl() );
    135135                // Also checking the type would be nice.
    136                 if ( decl ) {
    137                         // Pass.
    138                 } else if ( CatchStmt::Terminate == catchStmt->get_kind() ) {
    139                         SemanticError(catchStmt->location, "catch must have exception type");
    140                 } else {
    141                         SemanticError(catchStmt->location, "catchResume must have exception type");
     136                if ( !decl || !dynamic_cast<PointerType *>( decl->type ) ) {
     137                        std::string kind = (CatchStmt::Terminate == catchStmt->kind) ? "catch" : "catchResume";
     138                        SemanticError( catchStmt->location, kind + " must have pointer to an exception type" );
    142139                }
    143140
Note: See TracChangeset for help on using the changeset viewer.