| 822 | } |
| 823 | |
| 824 | sendMap(id: ImportId, path: PropertyPath, captures: StubHook[], instructions: unknown[]) |
| 825 | : RpcImportHook { |
| 826 | if (this.abortReason) { |
| 827 | for (let cap of captures) { |
| 828 | cap.dispose(); |
| 829 | } |
| 830 | throw this.abortReason; |
| 831 | } |
| 832 | |
| 833 | let devaluedCaptures = captures.map(hook => { |
| 834 | let importId = this.getImport(hook); |
| 835 | if (importId !== undefined) { |
| 836 | return ["import", importId]; |
| 837 | } else { |
| 838 | return ["export", this.exportStub(hook)]; |
| 839 | } |
| 840 | }); |
| 841 | |
| 842 | let value = ["remap", id, path, devaluedCaptures, instructions]; |
| 843 | |
| 844 | this.send(["push", value]); |
| 845 | |
| 846 | let entry = new ImportTableEntry(this, this.imports.length, false); |
| 847 | this.imports.push(entry); |
| 848 | return new RpcImportHook(/*isPromise=*/true, entry); |
| 849 | } |
| 850 | |
| 851 | sendPull(id: ImportId) { |
| 852 | if (this.abortReason) throw this.abortReason; |