Fixed while/for loops not returning from function

This commit is contained in:
Deukhoofd committed 2018-12-10 17:03:04 +01:00
1 parent 5646ff1da1
commit 88e4b92b6a
2 files changed
+14 -1

No files matched your search

+14
View File
@@ -705,7 +705,14 @@ namespace Upsilon.Evaluator
innerEvaluator.Scope.CreateLocal(e.Variables[1], table[1]);
innerEvaluator.EvaluateBoundBlockStatement((BoundBlockStatement) e.Block);
if (innerEvaluator.HasBroken || innerEvaluator.HasReturned)
{
if (innerEvaluator.HasReturned)
{
HasReturned = innerEvaluator.HasReturned;
_returnValue = innerEvaluator._returnValue;
}
break;
}
}
}
}
@@ -719,7 +726,14 @@ namespace Upsilon.Evaluator
{
innerEvaluator.EvaluateBoundBlockStatement(block);
if (innerEvaluator.HasBroken || innerEvaluator.HasReturned)
{
if (innerEvaluator.HasReturned)
{
HasReturned = innerEvaluator.HasReturned;
_returnValue = innerEvaluator._returnValue;
}
break;
}
}
}
}
-1
View File
@@ -2,7 +2,6 @@ using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using Upsilon.Text;
namespace Upsilon.Parser
{