| 59 | // `types-kernel-evaluation.ts` for why `any` alone is not enough). |
| 60 | _anyVersionAtPush: ce._anyVersion, |
| 61 | _semanticVersionAtPush: ce._semanticVersion, |
| 62 | _worldVersionAtPush: ce._worldVersion, |
| 63 | }); |
| 64 | } |
| 65 | |
| 66 | export function popEvalContext(ce: IComputeEngine): void { |
| 67 | discardEvalContext(ce, ce._evalContextStack.pop()); |
| 68 | } |
| 69 | |
| 70 | /** |
| 71 | * Remove one SPECIFIC evaluation context, wherever it currently sits. |
| 72 | * |
| 73 | * The asynchronous evaluation path holds its context across an `await` |
| 74 | * (`BoxedFunction._computeValueAsync`), so by the time it unwinds, its frame is |
| 75 | * not necessarily on top: another evaluation on the same engine may have pushed |
| 76 | * above it. Popping the top there would destroy a frame belonging to something |
| 77 | * still running — disposing its bindings out from under it. Removing by |
| 78 | * identity leaves every other frame intact. |
| 79 | * |
| 80 | * A no-op if the context is not on the stack (already removed). |
| 81 | */ |
| 82 | export function removeEvalContext( |
| 83 | ce: IComputeEngine, |