Index: translator/GenPoly/PolyMutator.cc
===================================================================
--- translator/GenPoly/PolyMutator.cc	(revision 51587aa493cba4720a447024fed1e9d94b78524a)
+++ translator/GenPoly/PolyMutator.cc	(revision 01aeadef077c992eb10d8adaf24ed68ff9c4b7ca)
@@ -5,18 +5,12 @@
 // file "LICENCE" distributed with Cforall.
 //
-// XXX.cc -- 
+// PolyMutator.cc -- 
 //
 // Author           : Richard C. Bilson
 // Created On       : Mon May 18 07:44:20 2015
-// Last Modified By : 
-// Last Modified On : 
-// Update Count     : 0
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Tue May 19 07:45:50 2015
+// Update Count     : 1
 //
-/*
- * This file is part of the Cforall project
- *
- * $Id: PolyMutator.cc,v 1.7 2005/08/29 20:14:13 rcbilson Exp $
- *
- */
 
 #include "PolyMutator.h"
@@ -29,177 +23,139 @@
 
 namespace GenPoly {
+	namespace {
+		const std::list<Label> noLabels;
+	}
 
-namespace {
-const std::list<Label> noLabels;
-}
+	PolyMutator::PolyMutator() : env( 0 ) {
+	}
 
-PolyMutator::PolyMutator()
-  : env( 0 )
-{
-}
+	void PolyMutator::mutateStatementList( std::list< Statement* > &statements ) {
+		for ( std::list< Statement* >::iterator i = statements.begin(); i != statements.end(); ++i ) {
+			if ( ! stmtsToAddAfter.empty() ) {
+				statements.splice( i, stmtsToAddAfter );
+			} // if
+			*i = (*i)->acceptMutator( *this );
+			if ( ! stmtsToAdd.empty() ) {
+				statements.splice( i, stmtsToAdd );
+			} // if
+		} // for
+		if ( ! stmtsToAddAfter.empty() ) {
+			statements.splice( statements.end(), stmtsToAddAfter );
+		} // if
+	}
 
-void
-PolyMutator::mutateStatementList( std::list< Statement* > &statements )
-{
-  for ( std::list< Statement* >::iterator i = statements.begin(); i != statements.end(); ++i ) {
-    if ( ! stmtsToAddAfter.empty() ) {
-      statements.splice( i, stmtsToAddAfter );
-    }
-    *i = (*i)->acceptMutator( *this );
-    if ( ! stmtsToAdd.empty() ) {
-      statements.splice( i, stmtsToAdd );
-    }
-  }
-  if ( ! stmtsToAddAfter.empty() ) {
-    statements.splice( statements.end(), stmtsToAddAfter );
-  }
-}
+	Statement * PolyMutator::mutateStatement( Statement *stmt ) {
+		Statement *newStmt = maybeMutate( stmt, *this );
+		if ( ! stmtsToAdd.empty() || ! stmtsToAddAfter.empty() ) {
+			CompoundStmt *compound = new CompoundStmt( noLabels );
+			compound->get_kids().splice( compound->get_kids().end(), stmtsToAdd );
+			compound->get_kids().push_back( newStmt );
+			compound->get_kids().splice( compound->get_kids().end(), stmtsToAddAfter );
+			// doEndScope();
+			return compound;
+		} else {
+			return newStmt;
+		}
+	}
 
-Statement*
-PolyMutator::mutateStatement( Statement *stmt )
-{
-  Statement *newStmt = maybeMutate( stmt, *this );
-  if ( ! stmtsToAdd.empty() || ! stmtsToAddAfter.empty() ) {
-    CompoundStmt *compound = new CompoundStmt( noLabels );
-    compound->get_kids().splice( compound->get_kids().end(), stmtsToAdd );
-    compound->get_kids().push_back( newStmt );
-    compound->get_kids().splice( compound->get_kids().end(), stmtsToAddAfter );
-    // doEndScope();
-    return compound;
-  } else {
-    return newStmt;
-  }
-}
+	Expression * PolyMutator::mutateExpression( Expression *expr ) {
+		if ( expr ) {
+			if ( expr->get_env() ) {
+				env = expr->get_env();
+			}
+			return expr->acceptMutator( *this );
+		} else {
+			return expr;
+		}
+	}
 
-Expression*
-PolyMutator::mutateExpression( Expression *expr )
-{
-  if ( expr ) {
-    if ( expr->get_env() ) {
-      env = expr->get_env();
-    }
-    return expr->acceptMutator( *this );
-  } else {
-    return expr;
-  }
-}
+	CompoundStmt * PolyMutator::mutate(CompoundStmt *compoundStmt) {
+		doBeginScope();
+		mutateStatementList( compoundStmt->get_kids() );
+		doEndScope();
+		return compoundStmt;
+	}
 
-CompoundStmt*
-PolyMutator::mutate(CompoundStmt *compoundStmt)
-{
-  doBeginScope();
-  mutateStatementList( compoundStmt->get_kids() );
-  doEndScope();
-  return compoundStmt;
-}
+	Statement * PolyMutator::mutate(IfStmt *ifStmt) {
+		ifStmt->set_thenPart(  mutateStatement( ifStmt->get_thenPart() ) );
+		ifStmt->set_elsePart(  mutateStatement( ifStmt->get_elsePart() ) );
+		ifStmt->set_condition(  mutateExpression( ifStmt->get_condition() ) );
+		return ifStmt;
+	}
 
-Statement*
-PolyMutator::mutate(IfStmt *ifStmt)
-{
-  ifStmt->set_thenPart(  mutateStatement( ifStmt->get_thenPart() ) );
-  ifStmt->set_elsePart(  mutateStatement( ifStmt->get_elsePart() ) );
-  ifStmt->set_condition(  mutateExpression( ifStmt->get_condition() ) );
-  return ifStmt;
-}
+	Statement * PolyMutator::mutate(WhileStmt *whileStmt) {
+		whileStmt->set_body(  mutateStatement( whileStmt->get_body() ) );
+		whileStmt->set_condition(  mutateExpression( whileStmt->get_condition() ) );
+		return whileStmt;
+	}
 
-Statement*
-PolyMutator::mutate(WhileStmt *whileStmt)
-{
-  whileStmt->set_body(  mutateStatement( whileStmt->get_body() ) );
-  whileStmt->set_condition(  mutateExpression( whileStmt->get_condition() ) );
-  return whileStmt;
-}
+	Statement * PolyMutator::mutate(ForStmt *forStmt) {
+		forStmt->set_body(  mutateStatement( forStmt->get_body() ) );
+		forStmt->set_initialization(  maybeMutate( forStmt->get_initialization(), *this ) );
+		forStmt->set_condition(  mutateExpression( forStmt->get_condition() ) );
+		forStmt->set_increment(  mutateExpression( forStmt->get_increment() ) );
+		return forStmt;
+	}
 
-Statement*
-PolyMutator::mutate(ForStmt *forStmt)
-{
-  forStmt->set_body(  mutateStatement( forStmt->get_body() ) );
-  forStmt->set_initialization(  maybeMutate( forStmt->get_initialization(), *this ) );
-  forStmt->set_condition(  mutateExpression( forStmt->get_condition() ) );
-  forStmt->set_increment(  mutateExpression( forStmt->get_increment() ) );
-  return forStmt;
-}
+	Statement * PolyMutator::mutate(SwitchStmt *switchStmt) {
+		mutateStatementList( switchStmt->get_branches() );
+		switchStmt->set_condition( mutateExpression( switchStmt->get_condition() ) );
+		return switchStmt;
+	}
 
-Statement*
-PolyMutator::mutate(SwitchStmt *switchStmt)
-{
-  mutateStatementList( switchStmt->get_branches() );
-  switchStmt->set_condition( mutateExpression( switchStmt->get_condition() ) );
-  return switchStmt;
-}
+	Statement * PolyMutator::mutate(ChooseStmt *switchStmt) {
+		mutateStatementList( switchStmt->get_branches() );
+		switchStmt->set_condition( mutateExpression( switchStmt->get_condition() ) );
+		return switchStmt;
+	}
 
-Statement*
-PolyMutator::mutate(ChooseStmt *switchStmt)
-{
-  mutateStatementList( switchStmt->get_branches() );
-  switchStmt->set_condition( mutateExpression( switchStmt->get_condition() ) );
-  return switchStmt;
-}
+	Statement * PolyMutator::mutate(CaseStmt *caseStmt) {
+		mutateStatementList( caseStmt->get_statements() );
+		caseStmt->set_condition(  mutateExpression( caseStmt->get_condition() ) );
+		return caseStmt;
+	}
 
-Statement*
-PolyMutator::mutate(CaseStmt *caseStmt)
-{
-  mutateStatementList( caseStmt->get_statements() );
-  caseStmt->set_condition(  mutateExpression( caseStmt->get_condition() ) );
+	Statement * PolyMutator::mutate(TryStmt *tryStmt) {
+		tryStmt->set_block(  maybeMutate( tryStmt->get_block(), *this ) );
+		mutateAll( tryStmt->get_catchers(), *this );
+		return tryStmt;
+	}
 
-  return caseStmt;
-}
+	Statement * PolyMutator::mutate(CatchStmt *cathStmt) {
+		cathStmt->set_body(  mutateStatement( cathStmt->get_body() ) );
+		cathStmt->set_decl(  maybeMutate( cathStmt->get_decl(), *this ) );
+		return cathStmt;
+	}
 
-Statement*
-PolyMutator::mutate(TryStmt *tryStmt)
-{
-  tryStmt->set_block(  maybeMutate( tryStmt->get_block(), *this ) );
-  mutateAll( tryStmt->get_catchers(), *this );
-  
-  return tryStmt;
-}
+	Statement * PolyMutator::mutate(ReturnStmt *retStmt) {
+		retStmt->set_expr( mutateExpression( retStmt->get_expr() ) );
+		return retStmt;
+	}
 
-Statement*
-PolyMutator::mutate(CatchStmt *cathStmt)
-{
-  cathStmt->set_body(  mutateStatement( cathStmt->get_body() ) );
-  cathStmt->set_decl(  maybeMutate( cathStmt->get_decl(), *this ) );
-  return cathStmt;
-}
-
-Statement* 
-PolyMutator::mutate(ReturnStmt *retStmt)
-{
-  retStmt->set_expr( mutateExpression( retStmt->get_expr() ) );
-  return retStmt;
-}
-
-Statement* 
-PolyMutator::mutate(ExprStmt *exprStmt)
-{
-  exprStmt->set_expr( mutateExpression( exprStmt->get_expr() ) );
-  return exprStmt;
-}
+	Statement * PolyMutator::mutate(ExprStmt *exprStmt) {
+		exprStmt->set_expr( mutateExpression( exprStmt->get_expr() ) );
+		return exprStmt;
+	}
 
 
-Expression* 
-PolyMutator::mutate(UntypedExpr *untypedExpr)
-{
-  for ( std::list< Expression* >::iterator i = untypedExpr->get_args().begin(); i != untypedExpr->get_args().end(); ++i ) {
-    *i = mutateExpression( *i );
-  }
-  return untypedExpr;
-}
+	Expression * PolyMutator::mutate(UntypedExpr *untypedExpr) {
+		for ( std::list< Expression* >::iterator i = untypedExpr->get_args().begin(); i != untypedExpr->get_args().end(); ++i ) {
+			*i = mutateExpression( *i );
+		} // for
+		return untypedExpr;
+	}
  
-/* static class method */
-void 
-PolyMutator::makeTyVarMap( Type *type, TyVarMap &tyVarMap )
-{
-  for ( std::list< TypeDecl* >::const_iterator tyVar = type->get_forall().begin(); tyVar != type->get_forall().end(); ++tyVar ) {
-    assert( *tyVar );
-    tyVarMap[ (*tyVar)->get_name() ] = (*tyVar)->get_kind();
-  }
-  if ( PointerType *pointer = dynamic_cast< PointerType* >( type ) ) {
-    makeTyVarMap( pointer->get_base(), tyVarMap );
-  }
-}
+	/* static class method */
+	void PolyMutator::makeTyVarMap( Type *type, TyVarMap &tyVarMap ) {
+		for ( std::list< TypeDecl* >::const_iterator tyVar = type->get_forall().begin(); tyVar != type->get_forall().end(); ++tyVar ) {
+			assert( *tyVar );
+			tyVarMap[ (*tyVar)->get_name() ] = (*tyVar)->get_kind();
+		}
+		if ( PointerType *pointer = dynamic_cast< PointerType* >( type ) ) {
+			makeTyVarMap( pointer->get_base(), tyVarMap );
+		}
+	}
+} // namespace GenPoly
 
-/* static class method */
-} // namespace GenPoly
 // Local Variables: //
 // tab-width: 4 //
