()
| 542 | } |
| 543 | |
| 544 | async next(): Promise<IteratorResult<T>> { |
| 545 | // This sets this.lastRead to a new Promise right away, as opposed to |
| 546 | // saying `await this.lastRead; this.lastRead = this.serialNext();` which |
| 547 | // would not work because this.nextRead would be updated only after the |
| 548 | // promise resolves. |
| 549 | this.lastRead = this.lastRead.then(() => this.serialNext()); |
| 550 | return this.lastRead; |
| 551 | } |
| 552 | |
| 553 | private async serialNext(): Promise<IteratorResult<T>> { |
| 554 | return this.upstream.next(); |
nothing calls this directly
no test coverage detected