Fixed while/for loops not returning from function
This commit is contained in:
parent
5646ff1da1
commit
88e4b92b6a
|
@ -705,10 +705,17 @@ 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void EvaluateWhileStatement(BoundWhileStatement e)
|
||||
{
|
||||
|
@ -719,8 +726,15 @@ namespace Upsilon.Evaluator
|
|||
{
|
||||
innerEvaluator.EvaluateBoundBlockStatement(block);
|
||||
if (innerEvaluator.HasBroken || innerEvaluator.HasReturned)
|
||||
{
|
||||
if (innerEvaluator.HasReturned)
|
||||
{
|
||||
HasReturned = innerEvaluator.HasReturned;
|
||||
_returnValue = innerEvaluator._returnValue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -2,7 +2,6 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
using System.Linq;
|
||||
using Upsilon.Text;
|
||||
|
||||
namespace Upsilon.Parser
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue