| 510 | } |
| 511 | |
| 512 | exportStub(hook: StubHook): ExportId { |
| 513 | if (this.abortReason) throw this.abortReason; |
| 514 | |
| 515 | let existingExportId = this.reverseExports.get(hook); |
| 516 | if (existingExportId !== undefined) { |
| 517 | ++this.exports[existingExportId].refcount; |
| 518 | return existingExportId; |
| 519 | } else { |
| 520 | let exportId = this.nextExportId--; |
| 521 | this.exports[exportId] = { hook, refcount: 1 }; |
| 522 | this.reverseExports.set(hook, exportId); |
| 523 | // TODO: Use onBroken(). |
| 524 | return exportId; |
| 525 | } |
| 526 | } |
| 527 | |
| 528 | exportPromise(hook: StubHook): ExportId { |
| 529 | if (this.abortReason) throw this.abortReason; |