core/src/commands.cpp
changeset 100 706c7a69e448
parent 95 b3ffff030d5c
child 101 048f57d1123c
--- a/core/src/commands.cpp	Thu Nov 04 20:51:05 2010 +0000
+++ b/core/src/commands.cpp	Thu Nov 04 23:22:39 2010 +0000
@@ -3880,7 +3880,16 @@
 		{
 		aError.Report();
 		}
-
+	IterationComplete(aError.Error());
+	}
+
+void CCmdTime::HandleParserExit(CParser&)
+	{
+	IterationComplete(KErrNone);
+	}
+
+void CCmdTime::IterationComplete(TInt aError)
+	{
 	TUint32 countAfter = iFastCounter ? User::FastCounter() : User::NTickCount();
 	
 	TUint64 difference;
@@ -3938,9 +3947,9 @@
 			Printf(_L("%Lu\r\n"), difference);
 			}
 		}
-	if (aError.Error() < 0 || iIteration == iRepeatCount)
-		{
-		Complete(aError.Error());
+	if (aError < 0 || iIteration == iRepeatCount)
+		{
+		Complete(aError);
 		}
 	else
 		{
@@ -4009,21 +4018,29 @@
 
 void CCmdRepeat::HandleParserComplete(CParser&, const TError& aError)
 	{
-	TRAPD(err, HandleParserCompleteL(aError));
+	if (aError.Error() < 0)
+		{
+		aError.Report();
+		}
+	TRAPD(err, HandleParserCompleteL(aError.Error()));
 	if (err)
 		{
 		Complete(err);
 		}
 	}
 
-void CCmdRepeat::HandleParserCompleteL(const TError& aError)
-	{
-	if (aError.Error() < 0)
-		{
-		aError.Report();
-		}
-
-	if (((aError.Error() == KErrNone) || iKeepGoing) && ((++iCount < iNumRepeats) || iForever))
+void CCmdRepeat::HandleParserExit(CParser&)
+	{
+	TRAPD(err, HandleParserCompleteL(KErrNone));
+	if (err)
+		{
+		Complete(err);
+		}
+	}
+
+void CCmdRepeat::HandleParserCompleteL(TInt aError)
+	{
+	if (((aError == KErrNone) || iKeepGoing) && ((++iCount < iNumRepeats) || iForever))
 		{
 		delete iParser;
 		iParser = NULL;
@@ -4032,7 +4049,7 @@
 		}
 	else
 		{
-		Complete(aError.Error());
+		Complete(aError);
 		}
 	}
 
@@ -6183,8 +6200,17 @@
 		PrintError(err, _L("Aborted \"%S\" at line %d"), &aError.ScriptFileName(), aError.ScriptLineNumber());
 		iLastError = err;
 		}
-
-	if ((err < 0) && !iKeepGoing)
+	IterationComplete(err);
+	}
+
+void CCmdForEach::HandleParserExit(CParser&)
+	{
+	IterationComplete(KErrNone);
+	}
+
+void CCmdForEach::IterationComplete(TInt aError)
+	{
+	if ((aError < 0) && !iKeepGoing)
 		{
 		Complete(iLastError);
 		}