Throw error if for some reason the execution of a statement in a coroutine returns null

This commit is contained in:
Deukhoofd 2019-02-17 17:54:14 +01:00
parent 72623036a8
commit 02fb3867e1
No known key found for this signature in database
GPG Key ID: B4C087AC81641654
1 changed files with 5 additions and 0 deletions

View File

@ -39,6 +39,11 @@ namespace Upsilon.Binder
foreach (var statement in Statements)
{
var coroutine = statement.EvaluateCoroutine(scope, diagnostics, state);
if (coroutine == null)
{
diagnostics.LogError("Can't evaluate a statement, it returned nil.", statement.Span);
continue;
}
while (coroutine.MoveNext())
{
yield return coroutine.Current;