Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/StatementNode.cc

    r4f147cc rab57786  
    1010// Created On       : Sat May 16 14:59:41 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Aug 15 20:47:11 2016
    13 // Update Count     : 322
     12// Last Modified On : Sun Aug 21 11:59:37 2016
     13// Update Count     : 325
    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 = safe_dynamic_cast< StatementNode * >(curr);
     56                StatementNode *node = dynamic_cast< StatementNode * >(curr);
     57                assert( node );
    5758                assert( dynamic_cast< CaseStmt * >(node->stmt.get()) );
    5859                prev = curr;
     
    137138}
    138139
    139 Statement *build_branch( std::string identifier, BranchStmt::Type kind ) {
    140         return new BranchStmt( noLabels, identifier, kind );
     140Statement *build_branch( BranchStmt::Type kind ) {
     141        Statement * ret = new BranchStmt( noLabels, "", kind );
     142        return ret;
     143}
     144Statement *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;
    141148}
    142149Statement *build_computedgoto( ExpressionNode *ctl ) {
     
    159166        std::list< Statement * > branches;
    160167        buildMoveList< Statement, StatementNode >( catch_stmt, branches );
    161         CompoundStmt *tryBlock = safe_dynamic_cast< CompoundStmt * >(maybeMoveBuild< Statement >(try_stmt));
     168        CompoundStmt *tryBlock = dynamic_cast< CompoundStmt * >(maybeMoveBuild< Statement >(try_stmt));
     169        assert( tryBlock );
    162170        FinallyStmt *finallyBlock = dynamic_cast< FinallyStmt * >(maybeMoveBuild< Statement >(finally_stmt) );
    163171        return new TryStmt( noLabels, tryBlock, branches, finallyBlock );
Note: See TracChangeset for help on using the changeset viewer.