File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -1333,13 +1333,21 @@ class LibraryEnv {
13331333
13341334 // Since we don't own PrevEnv do not capture it in scheme land.
13351335 Value After = Context.CreateLambda (
1336- [PrevOpGen, PrevEnv](heavy::Context& C, ValueRefs) {
1336+ [PrevOpGen, PrevEnv](heavy::Context& C, ValueRefs Args ) {
13371337 C.setEnvironment (PrevEnv);
13381338 C.OpGen = PrevOpGen;
1339+ if (Args.size () == 1 && isa<Error>(Args[0 ]))
1340+ return C.Cont (Args[0 ]);
13391341 C.Cont ();
13401342 }, {});
13411343
1342- Context.DynamicWind (std::move (Ptr), Before, Thunk, After);
1344+ Value SafeThunk = Context.CreateLambda ([](heavy::Context& C, ValueRefs) {
1345+ heavy::Value Thunk = C.getCapture (0 );
1346+ heavy::Value After = C.getCapture (1 );
1347+ // Clean up with the After-thunk.
1348+ C.WithExceptionHandler (After, Thunk);
1349+ }, CaptureList{Thunk, After});
1350+ Context.DynamicWind (std::move (Ptr), Before, SafeThunk, After);
13431351 }
13441352};
13451353} // namespace
You can’t perform that action at this time.
0 commit comments