Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ControlStruct/MultiLevelExit.cpp

    r400b8be rf75e25b  
    588588                }
    589589
     590                ptr<Stmt> else_stmt = nullptr;
     591                Stmt * loop_kid = nullptr;
     592                // check if loop node and if so add else clause if it exists
     593                const WhileDoStmt * whilePtr = dynamic_cast<const WhileDoStmt *>(kid.get());
     594                if ( whilePtr && whilePtr->else_) {
     595                        else_stmt = whilePtr->else_;
     596                        WhileDoStmt * mutate_ptr = mutate(whilePtr);
     597                        mutate_ptr->else_ = nullptr;
     598                        loop_kid = mutate_ptr;
     599                }
     600                const ForStmt * forPtr = dynamic_cast<const ForStmt *>(kid.get());
     601                if ( forPtr && forPtr->else_) {
     602                        else_stmt = forPtr->else_;
     603                        ForStmt * mutate_ptr = mutate(forPtr);
     604                        mutate_ptr->else_ = nullptr;
     605                        loop_kid = mutate_ptr;
     606                }
     607
    590608                try {
    591                         ret.push_back( kid->accept( *visitor ) );
     609                        if (else_stmt) ret.push_back( loop_kid->accept( *visitor ) );
     610                        else ret.push_back( kid->accept( *visitor ) );
    592611                } catch ( SemanticErrorException & e ) {
    593612                        errors.append( e );
    594613                }
     614
     615                if (else_stmt) ret.push_back(else_stmt);
    595616
    596617                if ( ! break_label.empty() ) {
Note: See TracChangeset for help on using the changeset viewer.