Skip to content

Commit 31b4684

Browse files
committed
fix CI
1 parent 945fe63 commit 31b4684

File tree

2 files changed

+23
-25
lines changed

2 files changed

+23
-25
lines changed

jscomp/core/js_of_lam_variant.ml

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -32,27 +32,25 @@ type arg_expression =
3232

3333
(* we need destruct [undefined] when input is optional *)
3434
let eval (arg : J.expression) (dispatches : (Ast_compatible.hash_label * string) list option) : E.t =
35-
if arg == E.undefined then E.undefined else
36-
match arg.expression_desc with
37-
| Str (_,s) ->
38-
let s = match dispatches with
39-
| None -> s
40-
| Some dispatches ->
41-
(Ext_list.assoc_by_string dispatches s None) in
42-
E.str s
43-
| _ ->
44-
match dispatches with
45-
| None ->
46-
E.poly_var_tag_access arg
47-
| Some dispatches ->
48-
E.of_block
49-
[(S.string_switch arg
50-
(Ext_list.map dispatches (fun (i,r) ->
51-
{J.switch_case = i ;
52-
switch_body = [S.return_stmt (E.str r)];
53-
should_break = false; (* FIXME: if true, still print break*)
54-
comment = None;
55-
})))]
35+
match dispatches with
36+
| None -> arg
37+
| Some dispatches ->
38+
if arg == E.undefined then E.undefined
39+
else
40+
match arg.expression_desc with
41+
| Str (_,s) ->
42+
let s =
43+
(Ext_list.assoc_by_string dispatches s None) in
44+
E.str s
45+
| _ ->
46+
E.of_block
47+
[(S.string_switch arg
48+
(Ext_list.map dispatches (fun (i,r) ->
49+
{J.switch_case = i ;
50+
switch_body = [S.return_stmt (E.str r)];
51+
should_break = false; (* FIXME: if true, still print break*)
52+
comment = None;
53+
})))]
5654

5755
(** invariant: optional is not allowed in this case *)
5856
(** arg is a polyvar *)

jscomp/test/gpr_2503_test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ function b(loc, b$1) {
2222
function makeWrapper(foo, param) {
2323
var tmp = {};
2424
if (foo !== undefined) {
25-
tmp.foo = Caml_option.valFromOption(foo).NAME;
25+
tmp.foo = Caml_option.valFromOption(foo);
2626
}
2727
console.log(tmp);
2828

2929
}
3030

3131
function makeWrapper2(foo, param) {
3232
console.log({
33-
foo: foo.NAME
33+
foo: foo
3434
});
3535

3636
}
@@ -41,7 +41,7 @@ function makeWrapper3(foo, param) {
4141
console.log(2);
4242
var tmp = {};
4343
if (foo !== undefined) {
44-
tmp.foo = Caml_option.valFromOption(foo).NAME;
44+
tmp.foo = Caml_option.valFromOption(foo);
4545
}
4646
return tmp;
4747
}
@@ -53,7 +53,7 @@ function makeWrapper4(foo, param) {
5353
foo > 10 ? "b" : "a"
5454
);
5555
if (tmp$1 !== undefined) {
56-
tmp.foo = Caml_option.valFromOption(tmp$1).NAME;
56+
tmp.foo = Caml_option.valFromOption(tmp$1);
5757
}
5858
return tmp;
5959
}

0 commit comments

Comments
 (0)