protected override IEnumerator LoopCoroutine(Flow flow) { var loop = Start(flow, out var enumerator, out var dictionaryEnumerator, out var currentIndex); var stack = flow.PreserveStack(); try { while (flow.LoopIsNotBroken(loop) && MoveNext(flow, enumerator, dictionaryEnumerator, ref currentIndex)) { yield return(body); flow.RestoreStack(stack); } } finally { (enumerator as IDisposable)?.Dispose(); } flow.DisposePreservedStack(stack); flow.ExitLoop(loop); yield return(exit); }
protected override IEnumerator LoopCoroutine(Flow flow) { var loop = Start(flow); var stack = flow.PreserveStack(); while (flow.LoopIsNotBroken(loop) && CanMoveNext(flow)) { yield return(body); flow.RestoreStack(stack); } flow.DisposePreservedStack(stack); flow.ExitLoop(loop); yield return(exit); }
protected override ControlOutput Loop(Flow flow) { var loop = Start(flow); var stack = flow.PreserveStack(); while (flow.LoopIsNotBroken(loop) && CanMoveNext(flow)) { flow.Invoke(body); flow.RestoreStack(stack); } flow.DisposePreservedStack(stack); flow.ExitLoop(loop); return(exit); }
protected override ControlOutput Loop(Flow flow) { var loop = Start(flow, out int currentIndex, out int lastIndex, out bool ascending); var stack = flow.PreserveStack(); while (flow.LoopIsNotBroken(loop) && CanMoveNext(currentIndex, lastIndex, ascending)) { flow.Invoke(body); flow.RestoreStack(stack); MoveNext(flow, ref currentIndex); } flow.DisposePreservedStack(stack); flow.ExitLoop(loop); return(exit); }
protected override IEnumerator LoopCoroutine(Flow flow) { var loop = Start(flow, out int currentIndex, out int lastIndex, out bool ascending); var stack = flow.PreserveStack(); while (flow.LoopIsNotBroken(loop) && CanMoveNext(currentIndex, lastIndex, ascending)) { yield return(body); flow.RestoreStack(stack); MoveNext(flow, ref currentIndex); } flow.DisposePreservedStack(stack); flow.ExitLoop(loop); yield return(exit); }