()
| 70 | } |
| 71 | |
| 72 | function processTicksAndRejections() { |
| 73 | let tock; |
| 74 | do { |
| 75 | while ((tock = queue.shift()) !== null) { |
| 76 | const priorContextFrame = |
| 77 | AsyncContextFrame.exchange(tock[async_context_frame]); |
| 78 | |
| 79 | const asyncId = tock[async_id_symbol]; |
| 80 | emitBefore(asyncId, tock[trigger_async_id_symbol], tock); |
| 81 | |
| 82 | try { |
| 83 | const callback = tock.callback; |
| 84 | if (tock.args === undefined) { |
| 85 | callback(); |
| 86 | } else { |
| 87 | const args = tock.args; |
| 88 | switch (args.length) { |
| 89 | case 1: callback(args[0]); break; |
| 90 | case 2: callback(args[0], args[1]); break; |
| 91 | case 3: callback(args[0], args[1], args[2]); break; |
| 92 | case 4: callback(args[0], args[1], args[2], args[3]); break; |
| 93 | default: callback(...args); |
| 94 | } |
| 95 | } |
| 96 | } finally { |
| 97 | emitDestroy(asyncId); |
| 98 | } |
| 99 | |
| 100 | emitAfter(asyncId); |
| 101 | |
| 102 | AsyncContextFrame.set(priorContextFrame); |
| 103 | } |
| 104 | runMicrotasks(); |
| 105 | } while (!queue.isEmpty() || |
| 106 | (hasRejectionToWarn() && processPromiseRejections())); |
| 107 | setHasTickScheduled(false); |
| 108 | setHasRejectionToWarn(false); |
| 109 | } |
| 110 | |
| 111 | // `nextTick()` will not enqueue any callback when the process is about to |
| 112 | // exit since the callback would not have a chance to be executed. |
no test coverage detected
searching dependent graphs…