Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/StatementNode.cc

    rab57786 r4f147cc  
    1010// Created On       : Sat May 16 14:59:41 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Aug 21 11:59:37 2016
    13 // Update Count     : 325
     12// Last Modified On : Mon Aug 15 20:47:11 2016
     13// Update Count     : 322
    1414//
    1515
     
    5454        // find end of list and maintain previous pointer
    5555        for ( StatementNode * curr = prev; curr != nullptr; curr = (StatementNode *)curr->get_next() ) {
    56                 StatementNode *node = dynamic_cast< StatementNode * >(curr);
    57                 assert( node );
     56                StatementNode *node = safe_dynamic_cast< StatementNode * >(curr);
    5857                assert( dynamic_cast< CaseStmt * >(node->stmt.get()) );
    5958                prev = curr;
     
    138137}
    139138
    140 Statement *build_branch( BranchStmt::Type kind ) {
    141         Statement * ret = new BranchStmt( noLabels, "", kind );
    142         return ret;
    143 }
    144 Statement *build_branch( std::string *identifier, BranchStmt::Type kind ) {
    145         Statement * ret = new BranchStmt( noLabels, *identifier, kind );
    146         delete identifier;                                                                      // allocated by lexer
    147         return ret;
     139Statement *build_branch( std::string identifier, BranchStmt::Type kind ) {
     140        return new BranchStmt( noLabels, identifier, kind );
    148141}
    149142Statement *build_computedgoto( ExpressionNode *ctl ) {
     
    166159        std::list< Statement * > branches;
    167160        buildMoveList< Statement, StatementNode >( catch_stmt, branches );
    168         CompoundStmt *tryBlock = dynamic_cast< CompoundStmt * >(maybeMoveBuild< Statement >(try_stmt));
    169         assert( tryBlock );
     161        CompoundStmt *tryBlock = safe_dynamic_cast< CompoundStmt * >(maybeMoveBuild< Statement >(try_stmt));
    170162        FinallyStmt *finallyBlock = dynamic_cast< FinallyStmt * >(maybeMoveBuild< Statement >(finally_stmt) );
    171163        return new TryStmt( noLabels, tryBlock, branches, finallyBlock );
Note: See TracChangeset for help on using the changeset viewer.