(effect: Primitive)
| 538 | } |
| 539 | |
| 540 | runLoop(effect: Primitive): MicroExit<A, E> | Yield { |
| 541 | let yielding = false |
| 542 | let current: Primitive | Yield = effect |
| 543 | this.currentOpCount = 0 |
| 544 | try { |
| 545 | while (true) { |
| 546 | this.currentOpCount++ |
| 547 | if (!yielding && this.getRef(CurrentScheduler).shouldYield(this as any)) { |
| 548 | yielding = true |
| 549 | const prev = current |
| 550 | current = flatMap(yieldNow, () => prev as any) as any |
| 551 | } |
| 552 | current = (current as any)[evaluate](this) |
| 553 | if (current === Yield) { |
| 554 | const yielded = this._yielded! |
| 555 | if (MicroExitTypeId in yielded) { |
| 556 | this._yielded = undefined |
| 557 | return yielded |
| 558 | } |
| 559 | return Yield |
| 560 | } |
| 561 | } |
| 562 | } catch (error) { |
| 563 | if (!hasProperty(current, evaluate)) { |
| 564 | return exitDie(`MicroFiber.runLoop: Not a valid effect: ${String(current)}`) |
| 565 | } |
| 566 | return exitDie(error) |
| 567 | } |
| 568 | } |
| 569 | |
| 570 | getCont<S extends successCont | failureCont>( |
| 571 | symbol: S |
no test coverage detected