Fix IO suspension in both cek_run and cek_run_iterative
The _cek_io_suspend_hook was only added to cek_run_iterative (line 986) but the actual code path went through cek_run (line 624). Added the hook check to both functions. This fixes the "IO suspension in non-IO context" error that blocked hs-wait/perform from propagating through event handler → trampoline → eval_expr call chains. IO suspension now converts to VmSuspended via the hook, which the value_to_js wrapper catches and drives with _driveAsync. +42 OCaml test passes (3924→3966). IO suspension verified working in browser WASM: dom-on click handler → hs-wait → perform → suspend → _driveAsync → setTimeout → resume. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -621,7 +621,9 @@ and cek_run state =
|
||||
let result = resolver request final in
|
||||
run (cek_resume final result)
|
||||
| None ->
|
||||
raise (Eval_error (value_to_str (String "IO suspension in non-IO context")))
|
||||
(match !Sx_types._cek_io_suspend_hook with
|
||||
| Some hook -> hook final
|
||||
| None -> raise (Eval_error (value_to_str (String "IO suspension in non-IO context"))))
|
||||
else cek_value final
|
||||
in run state
|
||||
|
||||
|
||||
Reference in New Issue
Block a user