()
| 502 | } |
| 503 | |
| 504 | async run() { |
| 505 | assert(this.shouldRunModule(this.phase)); |
| 506 | // This path is hit by a require'd module that is imported again. |
| 507 | const status = this.module.getStatus(); |
| 508 | debug('ModuleJobSync.run()', status, this.module); |
| 509 | // If the module was previously required and errored, reject from import() again. |
| 510 | if (status === kErrored) { |
| 511 | throw this.module.getError(); |
| 512 | } else if (status > kInstantiated) { |
| 513 | if (this.evaluationPromise) { |
| 514 | await this.evaluationPromise; |
| 515 | } |
| 516 | return { __proto__: null, module: this.module }; |
| 517 | } else if (status === kInstantiated) { |
| 518 | // The evaluation may have been canceled because instantiate() detected TLA first. |
| 519 | // But when it is imported again, it's fine to re-evaluate it asynchronously. |
| 520 | const timeout = -1; |
| 521 | const breakOnSigint = false; |
| 522 | this.evaluationPromise = this.module.evaluate(timeout, breakOnSigint); |
| 523 | await this.evaluationPromise; |
| 524 | this.evaluationPromise = undefined; |
| 525 | return { __proto__: null, module: this.module }; |
| 526 | } |
| 527 | |
| 528 | assert.fail('Unexpected status of a module that is imported again after being required. ' + |
| 529 | `Status = ${status}`); |
| 530 | } |
| 531 | |
| 532 | runSync(parent) { |
| 533 | debug('ModuleJobSync.runSync()', this.module); |
nothing calls this directly
no test coverage detected