(instructions: unknown[])
| 248 | } |
| 249 | |
| 250 | apply(instructions: unknown[]): RpcPayload { |
| 251 | try { |
| 252 | if (instructions.length < 1) { |
| 253 | throw new Error("Invalid empty mapper function."); |
| 254 | } |
| 255 | |
| 256 | for (let instruction of instructions.slice(0, -1)) { |
| 257 | let payload = new Evaluator(this).evaluateCopy(instruction); |
| 258 | |
| 259 | // The payload almost always contains a single stub. As an optimization, unwrap it. |
| 260 | if (payload.value instanceof RpcStub) { |
| 261 | let hook = unwrapStubNoProperties(payload.value); |
| 262 | if (hook) { |
| 263 | this.variables.push(hook); |
| 264 | continue; |
| 265 | } |
| 266 | } |
| 267 | |
| 268 | this.variables.push(new PayloadStubHook(payload)); |
| 269 | } |
| 270 | |
| 271 | return new Evaluator(this).evaluateCopy(instructions[instructions.length - 1]); |
| 272 | } finally { |
| 273 | for (let variable of this.variables) { |
| 274 | variable.dispose(); |
| 275 | } |
| 276 | } |
| 277 | } |
| 278 | |
| 279 | importStub(idx: ImportId): StubHook { |
| 280 | // This implies we saw an "export" appear inside the body of a mapper function. This should be |
no test coverage detected