| 51 | } |
| 52 | |
| 53 | makeOutput(result: RpcPayload): StubHook { |
| 54 | let devalued: unknown; |
| 55 | try { |
| 56 | devalued = Devaluator.devaluate(result.value, undefined, this, result); |
| 57 | } finally { |
| 58 | result.dispose(); |
| 59 | } |
| 60 | |
| 61 | // The result is the final instruction. This doesn't actually fit our MapInstruction type |
| 62 | // signature, so we cheat a bit. |
| 63 | this.instructions.push(<any>devalued); |
| 64 | |
| 65 | if (this.context.parent) { |
| 66 | this.context.parent.instructions.push( |
| 67 | ["remap", this.context.subject, this.context.path, |
| 68 | this.context.captures.map(cap => ["import", cap]), |
| 69 | this.instructions] |
| 70 | ); |
| 71 | return new MapVariableHook(this.context.parent, this.context.parent.instructions.length); |
| 72 | } else { |
| 73 | return this.context.subject.map(this.context.path, this.context.captures, this.instructions); |
| 74 | } |
| 75 | } |
| 76 | |
| 77 | pushCall(hook: StubHook, path: PropertyPath, params: RpcPayload): StubHook { |
| 78 | let devalued = Devaluator.devaluate(params.value, undefined, this, params); |