Changes in / [491bb81:e5628db]


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ControlStruct/MultiLevelExit.cpp

    r491bb81 re5628db  
    589589                }
    590590
     591                ptr<Stmt> else_stmt = nullptr;
     592                Stmt * loop_kid = nullptr;
     593                // check if loop node and if so add else clause if it exists
     594                const WhileDoStmt * whilePtr = dynamic_cast<const WhileDoStmt *>(kid.get());
     595                if ( whilePtr && whilePtr->else_) {
     596                        else_stmt = whilePtr->else_;
     597                        WhileDoStmt * mutate_ptr = mutate(whilePtr);
     598                        mutate_ptr->else_ = nullptr;
     599                        loop_kid = mutate_ptr;
     600                }
     601                const ForStmt * forPtr = dynamic_cast<const ForStmt *>(kid.get());
     602                if ( forPtr && forPtr->else_) {
     603                        else_stmt = forPtr->else_;
     604                        ForStmt * mutate_ptr = mutate(forPtr);
     605                        mutate_ptr->else_ = nullptr;
     606                        loop_kid = mutate_ptr;
     607                }
     608
    591609                try {
    592                         ret.push_back( kid->accept( *visitor ) );
     610                        if (else_stmt) ret.push_back( loop_kid->accept( *visitor ) );
     611                        else ret.push_back( kid->accept( *visitor ) );
    593612                } catch ( SemanticErrorException & e ) {
    594613                        errors.append( e );
    595614                }
    596615
    597                 // check if loop node and if so add else clause if it exists
    598                 const WhileDoStmt * whilePtr = dynamic_cast<const WhileDoStmt *>(kid.get());
    599                 if ( whilePtr && whilePtr->else_) ret.push_back(whilePtr->else_);
    600                 const ForStmt * forPtr = dynamic_cast<const ForStmt *>(kid.get());
    601                 if ( forPtr && forPtr->else_) ret.push_back(forPtr->else_);
     616                if (else_stmt) ret.push_back(else_stmt);
    602617
    603618                if ( ! break_label.empty() ) {
Note: See TracChangeset for help on using the changeset viewer.