Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/GenPoly/DeclMutator.cc

    r8ca3a72 r8688ce1  
    2020
    2121namespace GenPoly {
     22        namespace {
     23                const std::list<Label> noLabels;
     24        }
     25
    2226        DeclMutator::DeclMutator() : Mutator(), declsToAdd(1), declsToAddAfter(1) {}
    2327
    2428        DeclMutator::~DeclMutator() {}
    25 
     29       
    2630        void DeclMutator::mutateDeclarationList( std::list< Declaration* > &decls ) {
    2731                for ( std::list< Declaration* >::iterator decl = decls.begin(); ; ++decl ) {
     
    3034
    3135                        if ( decl == decls.end() ) break;
    32 
     36                       
    3337                        // run mutator on declaration
    3438                        *decl = maybeMutate( *decl, *this );
     
    5155                newBack->splice( newBack->end(), *back );
    5256                declsToAdd.pop_back();
    53 
     57               
    5458                back = declsToAddAfter.rbegin();
    5559                newBack = back + 1;
     
    6266                CompoundStmt *compoundStmt = dynamic_cast< CompoundStmt* >(stmt);
    6367                if ( compoundStmt ) return mutate( compoundStmt );
    64 
     68               
    6569                doBeginScope();
    66 
     70               
    6771                // run mutator on statement
    6872                stmt = maybeMutate( stmt, *this );
     
    98102                doBeginScope();
    99103
    100 
     104               
    101105                for ( std::list< Statement* >::iterator stmt = stmts.begin(); ; ++stmt ) {
    102106                        // add any new declarations after the previous statement
     
    108112
    109113                        if ( stmt == stmts.end() ) break;
    110 
     114                       
    111115                        // run mutator on statement
    112116                        *stmt = maybeMutate( *stmt, *this );
     
    119123                        declsToAdd.back().clear();
    120124                }
    121 
     125               
    122126                doEndScope();
    123127        }
     
    135139                return compoundStmt;
    136140        }
    137 
     141       
    138142        Statement* DeclMutator::mutate(IfStmt *ifStmt) {
    139143                ifStmt->set_condition( maybeMutate( ifStmt->get_condition(), *this ) );
     
    142146                return ifStmt;
    143147        }
    144 
     148       
    145149        Statement* DeclMutator::mutate(WhileStmt *whileStmt) {
    146150                whileStmt->set_condition( maybeMutate( whileStmt->get_condition(), *this ) );
     
    148152                return whileStmt;
    149153        }
    150 
     154       
    151155        Statement* DeclMutator::mutate(ForStmt *forStmt) {
    152156                mutateAll( forStmt->get_initialization(), *this );
     
    156160                return forStmt;
    157161        }
    158 
     162       
    159163        Statement* DeclMutator::mutate(SwitchStmt *switchStmt) {
    160164                switchStmt->set_condition( maybeMutate( switchStmt->get_condition(), *this ) );
     
    162166                return switchStmt;
    163167        }
    164 
     168       
    165169        Statement* DeclMutator::mutate(CaseStmt *caseStmt) {
    166170                caseStmt->set_condition( maybeMutate( caseStmt->get_condition(), *this ) );
     
    168172                return caseStmt;
    169173        }
    170 
     174       
    171175        Statement* DeclMutator::mutate(TryStmt *tryStmt) {
    172176                tryStmt->set_block( maybeMutate( tryStmt->get_block(), *this ) );
     
    175179                return tryStmt;
    176180        }
    177 
     181       
    178182        Statement* DeclMutator::mutate(CatchStmt *catchStmt) {
    179183                catchStmt->set_decl( maybeMutate( catchStmt->get_decl(), *this ) );
Note: See TracChangeset for help on using the changeset viewer.