src/ControlStruct/MLEMutator.cc
void MultiLevelExitMutator::fixBlock( std::list< Statement * > &kids, bool caseClause ) {
		SemanticErrorException errors;

		for ( std::list< Statement * >::iterator k = kids.begin(); k != kids.end(); k++ ) {
			if ( caseClause ) {
				// once a label is seen, it's no longer a valid fallthrough target
				for ( Label & l : (*k)->labels ) {
					fallthroughLabels.erase( l );
				}
			}

			// aggregate errors since the PassVisitor mutate loop was unrollled
			try {
				*k = (*k)->acceptMutator(*visitor);
			} catch( SemanticErrorException &e ) {
				errors.append( e );
			}

			if ( ! get_breakLabel().empty() ) {
				std::list< Statement * >::iterator next = k+1;
				std::list<Label> ls; ls.push_back( get_breakLabel() );
				kids.insert( next, new NullStmt( ls ) );
				set_breakLabel("");
			} // if
		} // for

		if ( ! errors.isEmpty() ) {
			throw errors;
		}
	}
// break labels have to come after the statement they break out of, so mutate a statement, then if they inform us
// through the breakLabel field tha they need a place to jump to on a break statement, add the break label to the
// body of statements
break labels have to come after the statement they break out of, so mutate a statement, then if they inform us
through the breakLabel field tha they need a place to jump to on a break statement, add the break label to the
body of statements
break labels have to come after the statement they break out of so mutate a statement then if they inform us through the breakLabel field tha they need a place to jump to on a break statement add the break label to the body of statements
void MultiLevelExitMutator::fixBlock( std::list< Statement * > &kids, bool caseClause ) {
		SemanticErrorException errors;
		for ( std::list< Statement * >::iterator k = kids.begin(); k != kids.end(); k++ ) {
			if ( caseClause ) {
				for ( Label & l : (*k)->labels ) {
					fallthroughLabels.erase( l );
				}
			}
			try {
				*k = (*k)->acceptMutator(*visitor);
			} catch( SemanticErrorException &e ) {
				errors.append( e );
			}
			if ( ! get_breakLabel().empty() ) {
				std::list< Statement * >::iterator next = k+1;
				std::list<Label> ls; ls.push_back( get_breakLabel() );
				kids.insert( next, new NullStmt( ls ) );
				set_breakLabel("");
			} 
		} 
		if ( ! errors.isEmpty() ) {
			throw errors;
		}
	}
void MultiLevelExitMutator :: fixBlock ( std :: list < Statement * > & kids , bool caseClause ) { SemanticErrorException errors ; for ( std :: list < Statement * > :: iterator k = kids . begin ( ) ; k != kids . end ( ) ; k ++ ) { if ( caseClause ) { for ( Label & l : ( * k ) -> labels ) { fallthroughLabels . erase ( l ) ; } } try { * k = ( * k ) -> acceptMutator ( * visitor ) ; } catch ( SemanticErrorException & e ) { errors . append ( e ) ; } if ( ! get_breakLabel ( ) . empty ( ) ) { std :: list < Statement * > :: iterator next = k + 1 ; std :: list < Label > ls ; ls . push_back ( get_breakLabel ( ) ) ; kids . insert ( next , new NullStmt ( ls ) ) ; set_breakLabel ( " " ) ; } } if ( ! errors . isEmpty ( ) ) { throw errors ; } }
break labels have to come after the statement they break out of, so mutate a statement, then if they inform us
through the breakLabel field tha they need a place to jump to on a break statement, add the break label to the
body of statements
break labels have to come after the statement they break out of so mutate a statement then if they inform us through the breakLabel field tha they need a place to jump to on a break statement add the break label to the body of statements
// once a label is seen, it's no longer a valid fallthrough target // aggregate errors since the PassVisitor mutate loop was unrollled // if // for