Fix while loops not breaking
This commit is contained in:
parent
00cc59dfbd
commit
74bc57bb1a
|
@ -705,7 +705,7 @@ namespace Upsilon.Evaluator
|
||||||
if (e.Variables[1].Name != "_")
|
if (e.Variables[1].Name != "_")
|
||||||
innerEvaluator.Scope.CreateLocal(e.Variables[1], table[1]);
|
innerEvaluator.Scope.CreateLocal(e.Variables[1], table[1]);
|
||||||
innerEvaluator.EvaluateBoundBlockStatement((BoundBlockStatement) e.Block);
|
innerEvaluator.EvaluateBoundBlockStatement((BoundBlockStatement) e.Block);
|
||||||
if (innerEvaluator.HasBroken)
|
if (innerEvaluator.HasBroken || innerEvaluator.HasReturned)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -716,9 +716,11 @@ namespace Upsilon.Evaluator
|
||||||
var innerEvaluator = new Evaluator(_diagnostics, Scope, _script);
|
var innerEvaluator = new Evaluator(_diagnostics, Scope, _script);
|
||||||
|
|
||||||
var block = (BoundBlockStatement) e.Block;
|
var block = (BoundBlockStatement) e.Block;
|
||||||
while ((ScriptBoolean)EvaluateExpression(e.Condition))
|
while ((ScriptBoolean)innerEvaluator.EvaluateExpression(e.Condition))
|
||||||
{
|
{
|
||||||
innerEvaluator.EvaluateBoundBlockStatement(block);
|
innerEvaluator.EvaluateBoundBlockStatement(block);
|
||||||
|
if (innerEvaluator.HasBroken || innerEvaluator.HasReturned)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue