Fix coroutines breaking on if statements

This commit is contained in:
Deukhoofd 2019-02-17 17:53:22 +01:00
parent d121bb2409
commit 812ec7137b
No known key found for this signature in database
GPG Key ID: B4C087AC81641654
1 changed files with 6 additions and 3 deletions

View File

@ -64,14 +64,17 @@ namespace Upsilon.Binder
var condition = Condition.Expression.Evaluate(scope, diagnostics, ref state);
if ((ScriptBoolean) condition)
{
return Block.EvaluateCoroutine(scope, diagnostics, state);
yield return Block.EvaluateCoroutine(scope, diagnostics, state);
}
if (NextElseIf != null)
{
return NextElseIf.EvaluateCoroutine(scope, diagnostics, state);
yield return NextElseIf.EvaluateCoroutine(scope, diagnostics, state);
}
if (ElseStatement != null)
{
yield return ElseStatement.EvaluateCoroutine(scope, diagnostics, state);
}
return ElseStatement?.EvaluateCoroutine(scope, diagnostics, state);
}
}