Index: src/ResolvExpr/Resolver.cc
===================================================================
--- src/ResolvExpr/Resolver.cc	(revision 695e00deb437e7e1ea8ef4dd70418cf6c70c8896)
+++ src/ResolvExpr/Resolver.cc	(revision 8f98b782aebdb59bd3ba7eae826ba604a978928a)
@@ -118,26 +118,26 @@
 	}
 
+	Expression * findSingleExpression( Expression *untyped, const SymTab::Indexer &indexer ) {
+		TypeEnvironment env;
+		AlternativeFinder finder( indexer, env );
+		finder.find( untyped );
+		#if 0
+		if ( finder.get_alternatives().size() != 1 ) {
+			std::cout << "untyped expr is ";
+			untyped->print( std::cout );
+			std::cout << std::endl << "alternatives are:";
+			for ( std::list< Alternative >::const_iterator i = finder.get_alternatives().begin(); i != finder.get_alternatives().end(); ++i ) {
+				i->print( std::cout );
+			} // for
+		} // if
+		#endif
+		assertf( finder.get_alternatives().size() == 1, "findSingleExpression: must have exactly one alternative at the end." );
+		Alternative &choice = finder.get_alternatives().front();
+		Expression *newExpr = choice.expr->clone();
+		finishExpr( newExpr, choice.env );
+		return newExpr;
+	}
+
 	namespace {
-		Expression *findSingleExpression( Expression *untyped, const SymTab::Indexer &indexer ) {
-			TypeEnvironment env;
-			AlternativeFinder finder( indexer, env );
-			finder.find( untyped );
-#if 0
-			if ( finder.get_alternatives().size() != 1 ) {
-				std::cout << "untyped expr is ";
-				untyped->print( std::cout );
-				std::cout << std::endl << "alternatives are:";
-				for ( std::list< Alternative >::const_iterator i = finder.get_alternatives().begin(); i != finder.get_alternatives().end(); ++i ) {
-					i->print( std::cout );
-				} // for
-			} // if
-#endif
-			assertf( finder.get_alternatives().size() == 1, "findSingleExpression: must have exactly one alternative at the end." );
-			Alternative &choice = finder.get_alternatives().front();
-			Expression *newExpr = choice.expr->clone();
-			finishExpr( newExpr, choice.env );
-			return newExpr;
-		}
-
 		bool isIntegralType( Type *type ) {
 			if ( dynamic_cast< EnumInstType * >( type ) ) {
@@ -393,14 +393,14 @@
 	}
 
-	inline void resolveAsIf( Expression *& expr, Resolver & resolver ) {
+	inline void resolveAsIf( Expression *& expr, SymTab::Indexer & indexer ) {
 		if( !expr ) return;
-		Expression * newExpr = findSingleExpression( expr, resolver );
+		Expression * newExpr = findSingleExpression( expr, indexer );
 		delete expr;
 		expr = newExpr;
 	}
 
-	inline void resolveAsType( Expression *& expr, Type * type, Resolver & resolver ) {
+	inline void resolveAsType( Expression *& expr, Type * type, SymTab::Indexer & indexer ) {
 		if( !expr ) return;
-		Expression * newExpr = findSingleExpression( new CastExpr( expr, type ), resolver );
+		Expression * newExpr = findSingleExpression( new CastExpr( expr, type ), indexer );
 		delete expr;
 		expr = newExpr;
@@ -417,4 +417,5 @@
 
 	void Resolver::previsit( WaitForStmt * stmt ) {
+		visit_children = false;
 
 		// Resolve all clauses first
@@ -422,5 +423,5 @@
 
 			TypeEnvironment env;
-			AlternativeFinder funcFinder( *this, env );
+			AlternativeFinder funcFinder( indexer, env );
 
 			// Find all alternatives for a function in canonical form
@@ -511,5 +512,5 @@
 
 								// Check if the argument matches the parameter type in the current scope
-								if( ! unify( (*param)->get_type(), arg.expr->get_result(), resultEnv, resultNeed, resultHave, openVars, *this ) ) {
+								if( ! unify( (*param)->get_type(), arg.expr->get_result(), resultEnv, resultNeed, resultHave, openVars, this->indexer ) ) {
 									// Type doesn't match
 									stringstream ss;
@@ -573,6 +574,6 @@
 			// Resolve the conditions as if it were an IfStmt
 			// Resolve the statments normally
-			resolveAsIf( clause.condition, *this );
-			clause.statement->accept( *this );
+			resolveAsIf( clause.condition, this->indexer );
+			clause.statement->accept( *visitor );
 		}
 
@@ -582,7 +583,7 @@
 			// Resolve the conditions as if it were an IfStmt
 			// Resolve the statments normally
-			resolveAsType( stmt->timeout.time, new BasicType( noQualifiers, BasicType::LongLongUnsignedInt ), *this );
-			resolveAsIf  ( stmt->timeout.condition, *this );
-			stmt->timeout.statement->accept( *this );
+			resolveAsType( stmt->timeout.time, new BasicType( noQualifiers, BasicType::LongLongUnsignedInt ), this->indexer );
+			resolveAsIf  ( stmt->timeout.condition, this->indexer );
+			stmt->timeout.statement->accept( *visitor );
 		}
 
@@ -590,6 +591,6 @@
 			// Resolve the conditions as if it were an IfStmt
 			// Resolve the statments normally
-			resolveAsIf( stmt->orelse.condition, *this );
-			stmt->orelse.statement->accept( *this );
+			resolveAsIf( stmt->orelse.condition, this->indexer );
+			stmt->orelse.statement->accept( *visitor );
 		}
 	}
