Skip to content

Commit 2d9a57d

Browse files
committed
1 parent b520b07 commit 2d9a57d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+196
-184
lines changed

jscomp/core/js_dump.ml

+7-3
Original file line numberDiff line numberDiff line change
@@ -1250,12 +1250,16 @@ and statement_desc top cxt f (s : J.statement_desc) : cxt =
12501250
| Break -> break_nl f; cxt
12511251

12521252
| Return {return_value = e} ->
1253-
begin match e with
1254-
| {expression_desc = Fun (method_, l, b, env); _} ->
1253+
begin match e.expression_desc with
1254+
| Fun (method_, l, b, env) ->
12551255
let cxt =
12561256
pp_function method_ cxt f true l b env in
12571257
semi f ; cxt
1258-
| e ->
1258+
| Undefined ->
1259+
return_sp f;
1260+
semi f;
1261+
cxt
1262+
| _ ->
12591263
return_sp f ;
12601264
(* P.string f "return ";(\* ASI -- when there is a comment*\) *)
12611265
P.group f return_indent (fun _ ->

jscomp/test/custom_error_test.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ function test_js_error(param) {
1515
var exn = Caml_js_exceptions.internalToOCamlException(raw_exn);
1616
if (exn[0] === Js_exn.$$Error) {
1717
console.log(exn[1].stack);
18-
return undefined;
18+
return ;
1919
} else {
2020
throw exn;
2121
}
@@ -52,7 +52,7 @@ function example1(param) {
5252
var exn = Caml_js_exceptions.internalToOCamlException(raw_exn);
5353
if (exn[0] === Js_exn.$$Error) {
5454
console.log(exn[1].stack);
55-
return undefined;
55+
return ;
5656
} else {
5757
throw exn;
5858
}
@@ -70,7 +70,7 @@ function example2(param) {
7070
catch (raw_exn){
7171
var exn = Caml_js_exceptions.internalToOCamlException(raw_exn);
7272
if (exn[0] === Js_exn.$$Error) {
73-
return undefined;
73+
return ;
7474
} else {
7575
throw exn;
7676
}

jscomp/test/equal_box_test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function b(loc, x) {
2323
}
2424

2525
function f(param) {
26-
return undefined;
26+
return ;
2727
}
2828

2929
function shouldBeNull(param) {

jscomp/test/exception_repr_test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ Printexc.register_printer((function (param) {
5555
"A(%d)"
5656
]), param[1]);
5757
} else {
58-
return undefined;
58+
return ;
5959
}
6060
}));
6161

jscomp/test/exn_error_pattern.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ function f(match) {
1414
} else if (match[0] === Caml_builtin_exceptions.sys_error) {
1515
return 2;
1616
} else {
17-
return undefined;
17+
return ;
1818
}
1919
}
2020

@@ -33,7 +33,7 @@ function g(match) {
3333
} else if (match[0] === A || match[0] === B) {
3434
return match[1];
3535
} else {
36-
return undefined;
36+
return ;
3737
}
3838
}
3939

jscomp/test/ext_list_test.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,7 @@ function find_first_not(p, _param) {
626626
return Caml_option.some(a);
627627
}
628628
} else {
629-
return undefined;
629+
return ;
630630
}
631631
};
632632
}
@@ -643,7 +643,7 @@ function for_all_opt(p, _param) {
643643
continue ;
644644
}
645645
} else {
646-
return undefined;
646+
return ;
647647
}
648648
};
649649
}
@@ -725,7 +725,7 @@ function find_no_exn(p, _param) {
725725
continue ;
726726
}
727727
} else {
728-
return undefined;
728+
return ;
729729
}
730730
};
731731
}
@@ -742,7 +742,7 @@ function find_opt(p, _param) {
742742
continue ;
743743
}
744744
} else {
745-
return undefined;
745+
return ;
746746
}
747747
};
748748
}

jscomp/test/ext_string_test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ function check_any_suffix_case_then_chop(s, suffixes) {
169169
continue ;
170170
}
171171
} else {
172-
return undefined;
172+
return ;
173173
}
174174
};
175175
}
@@ -437,7 +437,7 @@ function rindex_rec_opt(s, _i, c) {
437437
while(true) {
438438
var i = _i;
439439
if (i < 0) {
440-
return undefined;
440+
return ;
441441
} else if (s.charCodeAt(i) === c) {
442442
return i;
443443
} else {

jscomp/test/flow_parser_reg_test.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -5704,7 +5704,7 @@ function primitive(param) {
57045704

57055705
}
57065706
} else {
5707-
return undefined;
5707+
return ;
57085708
}
57095709
} else {
57105710
return /* Null */2;
@@ -7287,7 +7287,7 @@ function peek_unary_op(env) {
72877287
if (match >= 46) {
72887288
if (match >= 94) {
72897289
if (match >= 102) {
7290-
return undefined;
7290+
return ;
72917291
} else {
72927292
switch (match - 94 | 0) {
72937293
case 0 :
@@ -7298,7 +7298,7 @@ function peek_unary_op(env) {
72987298
case 3 :
72997299
case 4 :
73007300
case 5 :
7301-
return undefined;
7301+
return ;
73027302
case 6 :
73037303
return /* Not */2;
73047304
case 7 :
@@ -7307,7 +7307,7 @@ function peek_unary_op(env) {
73077307
}
73087308
}
73097309
} else if (match !== 62 || !env[/* allow_await */14]) {
7310-
return undefined;
7310+
return ;
73117311
} else {
73127312
return /* Await */7;
73137313
}
@@ -7322,7 +7322,7 @@ function peek_unary_op(env) {
73227322

73237323
}
73247324
} else {
7325-
return undefined;
7325+
return ;
73267326
}
73277327
}
73287328

@@ -11336,7 +11336,7 @@ function _object$2(restricted_error) {
1133611336
]
1133711337
]]);
1133811338
} else {
11339-
return undefined;
11339+
return ;
1134011340
}
1134111341
}
1134211342
};

jscomp/test/js_option_test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ var option_suites_001 = /* :: */[
137137
return /* Eq */Block.__(0, [
138138
false,
139139
Js_option.isSomeValue(simpleEq, 3, Js_option.andThen((function (param) {
140-
return undefined;
140+
return ;
141141
}), 2))
142142
]);
143143
})

jscomp/test/mario_game.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -1043,7 +1043,7 @@ function update_player(player, keys, context) {
10431043
]), player[/* dir */6], context)
10441044
];
10451045
} else {
1046-
return undefined;
1046+
return ;
10471047
}
10481048
}
10491049

@@ -1122,7 +1122,7 @@ function evolve_enemy(player_dir, typ, spr, obj, context) {
11221122
switch (typ) {
11231123
case 0 :
11241124
obj[/* kill */8] = true;
1125-
return undefined;
1125+
return ;
11261126
case 1 :
11271127
var match = make$2(undefined, obj[/* dir */6], /* SEnemy */Block.__(1, [/* GKoopaShell */3]), context, /* tuple */[
11281128
obj[/* pos */1][/* x */0],
@@ -1162,7 +1162,7 @@ function evolve_enemy(player_dir, typ, spr, obj, context) {
11621162
} else {
11631163
set_vel_to_speed(obj);
11641164
}
1165-
return undefined;
1165+
return ;
11661166
}
11671167

11681168
}
@@ -1274,7 +1274,7 @@ function check_collision(c1, c2) {
12741274
var b2 = get_aabb(c2);
12751275
var o1 = c1[2];
12761276
if (col_bypass(c1, c2)) {
1277-
return undefined;
1277+
return ;
12781278
} else {
12791279
var vx = b1[/* center */0][/* x */0] - b2[/* center */0][/* x */0];
12801280
var vy = b1[/* center */0][/* y */1] - b2[/* center */0][/* y */1];
@@ -1299,7 +1299,7 @@ function check_collision(c1, c2) {
12991299
return /* East */2;
13001300
}
13011301
} else {
1302-
return undefined;
1302+
return ;
13031303
}
13041304
}
13051305
}

jscomp/test/ocaml_parsetree_test.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -1824,7 +1824,7 @@ register_error_of_exn((function (param) {
18241824
"Some fatal warnings were triggered (%d occurrences)"
18251825
]), param[1]);
18261826
} else {
1827-
return undefined;
1827+
return ;
18281828
}
18291829
}));
18301830

@@ -2183,7 +2183,7 @@ function get_docstring(info, dsl) {
21832183
continue ;
21842184
}
21852185
} else {
2186-
return undefined;
2186+
return ;
21872187
}
21882188
};
21892189
}
@@ -2246,7 +2246,7 @@ function get_pre_docs(pos) {
22462246
}
22472247
catch (exn){
22482248
if (exn === Caml_builtin_exceptions.not_found) {
2249-
return undefined;
2249+
return ;
22502250
} else {
22512251
throw exn;
22522252
}
@@ -2284,7 +2284,7 @@ function get_post_docs(pos) {
22842284
}
22852285
catch (exn){
22862286
if (exn === Caml_builtin_exceptions.not_found) {
2287-
return undefined;
2287+
return ;
22882288
} else {
22892289
throw exn;
22902290
}
@@ -2311,7 +2311,7 @@ function get_info(pos) {
23112311
}
23122312
catch (exn){
23132313
if (exn === Caml_builtin_exceptions.not_found) {
2314-
return undefined;
2314+
return ;
23152315
} else {
23162316
throw exn;
23172317
}
@@ -4896,7 +4896,7 @@ var yyact = /* array */[
48964896
], _4);
48974897
}),
48984898
(function (__caml_parser_env) {
4899-
return undefined;
4899+
return ;
49004900
}),
49014901
(function (__caml_parser_env) {
49024902
return Parsing.peek_val(__caml_parser_env, 0);
@@ -5185,7 +5185,7 @@ var yyact = /* array */[
51855185
return Parsing.peek_val(__caml_parser_env, 0);
51865186
}),
51875187
(function (__caml_parser_env) {
5188-
return undefined;
5188+
return ;
51895189
}),
51905190
(function (__caml_parser_env) {
51915191
var _1 = Parsing.peek_val(__caml_parser_env, 5);
@@ -5708,7 +5708,7 @@ var yyact = /* array */[
57085708
return mkpat(/* Ppat_any */0);
57095709
}),
57105710
(function (__caml_parser_env) {
5711-
return undefined;
5711+
return ;
57125712
}),
57135713
(function (__caml_parser_env) {
57145714
return Parsing.peek_val(__caml_parser_env, 0);

jscomp/test/ocaml_proto_test.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ function file_option(file_options, name) {
193193
}
194194
catch (exn){
195195
if (exn === Caml_builtin_exceptions.not_found) {
196-
return undefined;
196+
return ;
197197
} else {
198198
throw exn;
199199
}
@@ -259,7 +259,7 @@ function apply_until(f, _param) {
259259
continue ;
260260
}
261261
} else {
262-
return undefined;
262+
return ;
263263
}
264264
};
265265
}
@@ -3928,7 +3928,7 @@ function find_field_option(field_options, option_name) {
39283928
}
39293929
catch (exn){
39303930
if (exn === Caml_builtin_exceptions.not_found) {
3931-
return undefined;
3931+
return ;
39323932
} else {
39333933
throw exn;
39343934
}
@@ -4152,7 +4152,7 @@ function get_default(field_name, field_options, field_type) {
41524152
}
41534153
catch (exn){
41544154
if (exn === Caml_builtin_exceptions.not_found) {
4155-
return undefined;
4155+
return ;
41564156
} else {
41574157
throw exn;
41584158
}
@@ -4534,7 +4534,7 @@ function compile_message_p2(types, param, message) {
45344534
}
45354535
catch (exn){
45364536
if (exn === Caml_builtin_exceptions.not_found) {
4537-
return undefined;
4537+
return ;
45384538
} else {
45394539
throw exn;
45404540
}
@@ -6593,7 +6593,7 @@ function ocaml_container(field_options) {
65936593
if (match$1.tag === 4) {
65946594
return match$1[0];
65956595
} else {
6596-
return undefined;
6596+
return ;
65976597
}
65986598
}
65996599

0 commit comments

Comments
 (0)