Changeset 046e04a


Ignore:
Timestamp:
Jun 19, 2017, 4:23:46 PM (7 years ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
6a0d1b1e
Parents:
da24468
Message:

Now only CatchStmt? can be a handler on a TryStmt?.

Location:
src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/ParseNode.h

    rda24468 r046e04a  
    415415                                result->location = cur->location;
    416416                                * out++ = result;
     417                        } else {
     418                                assertf(false, "buildList unknown type");
    417419                        } // if
    418420                } catch( SemanticError &e ) {
  • src/Parser/StatementNode.cc

    rda24468 r046e04a  
    175175
    176176Statement *build_try( StatementNode *try_stmt, StatementNode *catch_stmt, StatementNode *finally_stmt ) {
    177         std::list< Statement * > branches;
    178         buildMoveList< Statement, StatementNode >( catch_stmt, branches );
     177        std::list< CatchStmt * > branches;
     178        buildMoveList< CatchStmt, StatementNode >( catch_stmt, branches );
    179179        CompoundStmt *tryBlock = safe_dynamic_cast< CompoundStmt * >(maybeMoveBuild< Statement >(try_stmt));
    180180        FinallyStmt *finallyBlock = dynamic_cast< FinallyStmt * >(maybeMoveBuild< Statement >(finally_stmt) );
  • src/SynTree/Statement.cc

    rda24468 r046e04a  
    313313}
    314314
    315 TryStmt::TryStmt( std::list<Label> labels, CompoundStmt *tryBlock, std::list<Statement *> &_handlers, FinallyStmt *_finallyBlock ) :
     315TryStmt::TryStmt( std::list<Label> labels, CompoundStmt *tryBlock, std::list<CatchStmt *> &_handlers, FinallyStmt *_finallyBlock ) :
    316316        Statement( labels ), block( tryBlock ),  handlers( _handlers ), finallyBlock( _finallyBlock ) {
    317317}
     
    334334        // handlers
    335335        os << string( indent + 2, ' ' ) << "and handlers: " << endl;
    336         for ( std::list<Statement *>::const_iterator i = handlers.begin(); i != handlers.end(); i++)
     336        for ( std::list<CatchStmt *>::const_iterator i = handlers.begin(); i != handlers.end(); i++)
    337337                (*i )->print( os, indent + 4 );
    338338
  • src/SynTree/Statement.h

    rda24468 r046e04a  
    315315class TryStmt : public Statement {
    316316  public:
    317         TryStmt( std::list<Label> labels, CompoundStmt *tryBlock, std::list<Statement *> &handlers, FinallyStmt *finallyBlock = 0 );
     317        TryStmt( std::list<Label> labels, CompoundStmt *tryBlock, std::list<CatchStmt *> &handlers, FinallyStmt *finallyBlock = 0 );
    318318        TryStmt( const TryStmt &other );
    319319        virtual ~TryStmt();
     
    321321        CompoundStmt *get_block() const { return block; }
    322322        void set_block( CompoundStmt *newValue ) { block = newValue; }
    323         std::list<Statement *>& get_catchers() { return handlers; }
     323        std::list<CatchStmt *>& get_catchers() { return handlers; }
    324324
    325325        FinallyStmt *get_finally() const { return finallyBlock; }
     
    333333  private:
    334334        CompoundStmt *block;
    335         std::list<Statement *> handlers;
     335        std::list<CatchStmt *> handlers;
    336336        FinallyStmt *finallyBlock;
    337337};
Note: See TracChangeset for help on using the changeset viewer.