Changes in / [e5628db:491bb81]


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ControlStruct/MultiLevelExit.cpp

    re5628db r491bb81  
    589589                }
    590590
    591                 ptr<Stmt> else_stmt = nullptr;
    592                 Stmt * loop_kid = nullptr;
     591                try {
     592                        ret.push_back( kid->accept( *visitor ) );
     593                } catch ( SemanticErrorException & e ) {
     594                        errors.append( e );
     595                }
     596
    593597                // check if loop node and if so add else clause if it exists
    594598                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                 }
     599                if ( whilePtr && whilePtr->else_) ret.push_back(whilePtr->else_);
    601600                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 
    609                 try {
    610                         if (else_stmt) ret.push_back( loop_kid->accept( *visitor ) );
    611                         else ret.push_back( kid->accept( *visitor ) );
    612                 } catch ( SemanticErrorException & e ) {
    613                         errors.append( e );
    614                 }
    615 
    616                 if (else_stmt) ret.push_back(else_stmt);
     601                if ( forPtr && forPtr->else_) ret.push_back(forPtr->else_);
    617602
    618603                if ( ! break_label.empty() ) {
Note: See TracChangeset for help on using the changeset viewer.