Skip to content

Commit e7d567b

Browse files
committed
Fix runtime deps, add missing test
1 parent 667ff85 commit e7d567b

File tree

6 files changed

+60
-8
lines changed

6 files changed

+60
-8
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
open Printf
2+
open Effect
3+
open Effect.Deep
4+
5+
type _ Effect.t += Dummy : unit t
6+
7+
let must_raise () =
8+
try_with
9+
(fun () ->
10+
Js_of_ocaml.Js.Effect.assume_no_perform (fun () ->
11+
(* Should raise [Effect.Unhandled] despite the installed handler *)
12+
perform Dummy
13+
)
14+
)
15+
()
16+
{ effc =
17+
(fun (type a) (e : a Effect.t) ->
18+
match e with
19+
| Dummy -> Some (fun (k : (a, _) continuation) -> continue k ())
20+
| _ -> None)
21+
}
22+
23+
let () =
24+
try
25+
must_raise (); print_endline "failed"; exit 2
26+
with Effect.Unhandled Dummy -> print_endline "ok"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ok
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
open Printf
2+
open Effect
3+
open Effect.Deep
4+
5+
type _ Effect.t += Dummy : unit t
6+
7+
let must_raise () =
8+
try_with
9+
(fun () ->
10+
Js_of_ocaml.Js.Effect.assume_no_perform (fun () ->
11+
(* Should raise [Effect.Unhandled] despite the installed handler *)
12+
perform Dummy
13+
)
14+
)
15+
()
16+
{ effc =
17+
(fun (type a) (e : a Effect.t) ->
18+
match e with
19+
| Dummy -> Some (fun (k : (a, _) continuation) -> continue k ())
20+
| _ -> None)
21+
}
22+
23+
let () =
24+
try
25+
must_raise (); print_endline "failed"; exit 2
26+
with Effect.Unhandled Dummy -> print_endline "ok"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ok

runtime/js/effect.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ function caml_pop_trap() {
7676
//Provides: caml_raise_unhandled
7777
//Requires: caml_named_value, caml_raise_with_arg, caml_raise_constant, caml_string_of_jsbytes, caml_fresh_oo_id
7878
//If: effects
79-
//If: doubletranslate
8079
function caml_raise_unhandled(eff) {
8180
var exn = caml_named_value("Effect.Unhandled");
8281
if (exn) caml_raise_with_arg(exn, eff);
@@ -90,11 +89,10 @@ function caml_raise_unhandled(eff) {
9089
}
9190
}
9291

93-
//Provides: caml_uncaught_effect_handler
92+
//Provides: uncaught_effect_handler
9493
//Requires: caml_resume_stack, caml_raise_unhandled
9594
//If: effects
96-
//If: doubletranslate
97-
function caml_uncaught_effect_handler(eff, k, ms) {
95+
function uncaught_effect_handler(eff, k, ms) {
9896
// Resumes the continuation k by raising exception Unhandled.
9997
caml_resume_stack(k[1], ms);
10098
caml_raise_unhandled(eff);

runtime/js/jslib.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -85,15 +85,15 @@ var caml_callback = caml_call_gen;
8585
//Provides: caml_callback
8686
//If: effects
8787
//If: !doubletranslate
88-
//Requires:caml_stack_depth, caml_call_gen, caml_exn_stack, caml_fiber_stack, caml_wrap_exception, caml_uncaught_effect_handler
88+
//Requires:caml_stack_depth, caml_call_gen, caml_exn_stack, caml_fiber_stack, caml_wrap_exception, uncaught_effect_handler
8989
function caml_callback(f, args) {
9090
var saved_stack_depth = caml_stack_depth;
9191
var saved_exn_stack = caml_exn_stack;
9292
var saved_fiber_stack = caml_fiber_stack;
9393
try {
9494
caml_exn_stack = 0;
9595
caml_fiber_stack = {
96-
h: [0, 0, 0, caml_uncaught_effect_handler],
96+
h: [0, 0, 0, uncaught_effect_handler],
9797
r: { k: 0, x: 0, e: 0 },
9898
};
9999
var res = {
@@ -125,7 +125,7 @@ function caml_callback(f, args) {
125125
//Provides: caml_callback
126126
//If: effects
127127
//If: doubletranslate
128-
//Requires:caml_stack_depth, caml_call_gen, caml_exn_stack, caml_fiber_stack, caml_uncaught_effect_handler
128+
//Requires:caml_stack_depth, caml_call_gen, caml_exn_stack, caml_fiber_stack, uncaught_effect_handler
129129
//Requires: caml_raise_constant
130130
function caml_callback(f, args) {
131131
var saved_stack_depth = caml_stack_depth;
@@ -134,7 +134,7 @@ function caml_callback(f, args) {
134134
try {
135135
caml_exn_stack = 0;
136136
caml_fiber_stack = {
137-
h: [0, 0, 0, caml_uncaught_effect_handler],
137+
h: [0, 0, 0, uncaught_effect_handler],
138138
r: { k: 0, x: 0, e: 0 },
139139
};
140140
return caml_call_gen(f, args);

0 commit comments

Comments
 (0)