File tree Expand file tree Collapse file tree 1 file changed +24
-15
lines changed
src/FSharp.Control.TaskSeq Expand file tree Collapse file tree 1 file changed +24
-15
lines changed Original file line number Diff line number Diff line change @@ -817,34 +817,43 @@ module internal TaskSeqInternal =
817817 yield e.Current
818818
819819 | Exclusive, PredicateAsync predicate -> // skipWhileAsync
820- while more do
821- let! passed = predicate e.Current
822- more <- passed
820+ let mutable cont = true
821+ if more then
822+ let! ok = predicate e.Current
823+ cont <- ok
823824
824- if more then
825- let! ok = e.MoveNextAsync()
826- more <- ok
825+ while more && cont do
826+ let! moveNext = e.MoveNextAsync()
827+ if moveNext then
828+ let! ok = predicate e.Current
829+ cont <- ok
830+
831+ more <- moveNext
827832
828- // yield the rest
829833 if more then
830834 // yield the last one where the predicate was false
831835 // (this ensures we skip 0 or more)
832836 yield e.Current
833837
834- while ! e.MoveNextAsync() do
838+ while ! e.MoveNextAsync() do // get the rest
835839 yield e.Current
836840
837841 | Inclusive, PredicateAsync predicate -> // skipWhileInclusiveAsync
838- while more do
839- let! passed = predicate e.Current
840- more <- passed
842+ let mutable cont = true
843+ if more then
844+ let! ok = predicate e.Current
845+ cont <- ok
841846
842- if more then
843- let! ok = e.MoveNextAsync()
844- more <- ok
847+ while more && cont do
848+ let! moveNext = e.MoveNextAsync()
849+ if moveNext then
850+ let! ok = predicate e.Current
851+ cont <- ok
852+
853+ more <- moveNext
845854
846855 if more then
847- // yield the rest ( this ensures we skip 1 or more)
856+ // get the rest, this gives 1 or more semantics
848857 while ! e.MoveNextAsync() do
849858 yield e.Current
850859 }
You can’t perform that action at this time.
0 commit comments