Throw error if for some reason the execution of a statement in a coroutine returns null
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user