Skip to content

Commit 3262d94

Browse files
committed
switch unit to undefined
1 parent f20d5a1 commit 3262d94

File tree

445 files changed

+5019
-5299
lines changed

Some content is hidden

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

445 files changed

+5019
-5299
lines changed

jscomp/core/js_exp_make.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ let new_ ?comment e0 args : t =
236236

237237

238238
let unit : t =
239-
{expression_desc = Number (Int {i = 0l; c = None}) ; comment = Some "()" }
239+
{expression_desc = Undefined ; comment = None}
240240

241241

242242

jscomp/core/lam.ml

+2-2
Original file line numberDiff line numberDiff line change
@@ -403,8 +403,8 @@ let true_ : t =
403403
let false_ : t =
404404
Lconst (Const_js_false)
405405

406-
let unit : t =
407-
Lconst (Const_pointer( 0, Pt_constructor {name = "()"; cstrs = 1,0}))
406+
let unit : t = Lconst Const_js_undefined
407+
408408

409409

410410

jscomp/core/lam_constant_convert.ml

+2
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ let rec convert_constant ( const : Lambda.structured_constant) : Lam_constant.t
3838
| Const_base (Const_int32 i) -> (Const_int32 i)
3939
| Const_base (Const_int64 i) -> (Const_int64 i)
4040
| Const_base (Const_nativeint i) -> (Const_nativeint i)
41+
| Const_pointer(0, Pt_constructor{name = "()"; cstrs = 1,0})
42+
-> Const_js_undefined
4143
| Const_pointer(i,p) ->
4244
begin match p with
4345
| Pt_constructor {name;cstrs} -> Const_pointer(i, Pt_constructor {name; cstrs})

jscomp/main/builtin_cmj_datasets.ml

+27-27
Large diffs are not rendered by default.

jscomp/test/406_primitive_test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ function f(param) {
3434
}
3535

3636
}
37-
return /* () */0;
37+
return ;
3838
}
3939
catch (raw_exn){
4040
var exn = Caml_js_exceptions.internalToOCamlException(raw_exn);
4141
if (exn[0] === A) {
42-
return /* () */0;
42+
return ;
4343
}
4444
throw exn;
4545
}

jscomp/test/a_filename_test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ function eq(loc, x, y) {
2727
],
2828
suites.contents
2929
];
30-
return /* () */0;
30+
3131
}
3232

3333
function test(param, param$1) {

jscomp/test/alias_test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ function ff(param) {
1111
return "cool test hello worldnothello worldnothello";
1212
}
1313

14-
var a23 = ff(/* () */0);
14+
var a23 = ff(undefined);
1515

1616
var a15 = a10;
1717

jscomp/test/argv_test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ var Arg = require("../../lib/js/arg.js");
44
var Block = require("../../lib/js/block.js");
55

66
function anno_fun(arg) {
7-
return /* () */0;
7+
88
}
99

1010
var usage_msg = "Usage:\n";

jscomp/test/arity.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ var Curry = require("../../lib/js/curry.js");
55
function u(f, a, b) {
66
console.log(f(a, b));
77
console.log(f(a, b));
8-
return /* () */0;
8+
99
}
1010

1111
function u2(f, a, b) {
1212
console.log(Curry._2(f, a, b));
1313
console.log(Curry._2(f, a, b));
14-
return /* () */0;
14+
1515
}
1616

1717
function f(x, y) {

jscomp/test/arity_deopt.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function eq(loc, x, y) {
2626
],
2727
suites.contents
2828
];
29-
return /* () */0;
29+
3030
}
3131

3232
function f0(x, y, z) {

jscomp/test/array_subtle_test.js

+5-6
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ function eq(loc, param) {
2828
],
2929
suites.contents
3030
];
31-
return /* () */0;
31+
3232
}
3333

3434
var v = [
@@ -86,8 +86,8 @@ function f(v) {
8686
} else {
8787
console.log("hi2");
8888
}
89-
console.log((v.pop(), /* () */0));
90-
return /* () */0;
89+
console.log((v.pop(), undefined));
90+
9191
}
9292

9393
function fff(x) {
@@ -97,10 +97,9 @@ function fff(x) {
9797
function fff2(x) {
9898
if (x.length >= 10) {
9999
console.log("hi");
100-
return /* () */0;
101-
} else {
102-
return /* () */0;
100+
return ;
103101
}
102+
104103
}
105104

106105
function fff3(x) {

jscomp/test/ast_abstract_test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function eq(loc, x, y) {
2626
],
2727
suites.contents
2828
];
29-
return /* () */0;
29+
3030
}
3131

3232
function tToJs(param) {

jscomp/test/ast_js_mapper_poly_test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ function eq(loc, x, y) {
2727
],
2828
suites.contents
2929
];
30-
return /* () */0;
30+
3131
}
3232

3333
var jsMapperConstantArray = [

jscomp/test/ast_mapper_defensive_test.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function $$throw(loc, x) {
2323
],
2424
suites.contents
2525
];
26-
return /* () */0;
26+
2727
}
2828

2929
function aToJs(param) {
@@ -76,17 +76,17 @@ function cFromJs(param) {
7676

7777
$$throw("File \"ast_mapper_defensive_test.ml\", line 28, characters 16-23", (function (param) {
7878
aFromJs(3);
79-
return /* () */0;
79+
8080
}));
8181

8282
$$throw("File \"ast_mapper_defensive_test.ml\", line 29, characters 15-22", (function (param) {
8383
bFromJs(2);
84-
return /* () */0;
84+
8585
}));
8686

8787
$$throw("File \"ast_mapper_defensive_test.ml\", line 30, characters 15-22", (function (param) {
8888
cFromJs(33);
89-
return /* () */0;
89+
9090
}));
9191

9292
Mt.from_pair_suites("Ast_mapper_defensive_test", suites.contents);

jscomp/test/attr_test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ var hh = max2(1, 2);
1616
function f(x) {
1717
des(x, (function () {
1818
console.log("hei");
19-
return /* () */0;
19+
2020
}));
21-
return /* () */0;
21+
2222
}
2323

2424
exports.u = u;

jscomp/test/basic_module_test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ var count = {
1111

1212
function test(set) {
1313
count.contents = Offset.$$Set.cardinal(set) + count.contents | 0;
14-
return /* () */0;
14+
1515
}
1616

1717
test(Curry._1(Offset.M.$$Set.singleton, "42"));

jscomp/test/bdd.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ function resize(newSize) {
6060
while(true) {
6161
var bucket = _bucket;
6262
if (!bucket) {
63-
return /* () */0;
63+
return ;
6464
}
6565
var n = bucket[0];
6666
if (typeof n === "number") {
@@ -87,7 +87,7 @@ function resize(newSize) {
8787
}
8888
htab.contents = newArr;
8989
sz_1.contents = newSz_1;
90-
return /* () */0;
90+
9191
}
9292

9393
function insert(idl, idh, v, ind, bucket, newNode) {
@@ -97,7 +97,7 @@ function insert(idl, idh, v, ind, bucket, newNode) {
9797
bucket
9898
]);
9999
n_items.contents = n_items.contents + 1 | 0;
100-
return /* () */0;
100+
return ;
101101
} else {
102102
resize((sz_1.contents + sz_1.contents | 0) + 2 | 0);
103103
var ind$1 = hashVal(idl, idh, v) & sz_1.contents;
@@ -113,7 +113,7 @@ function resetUnique(param) {
113113
htab.contents = Caml_array.caml_make_vect(sz_1.contents + 1 | 0, /* [] */0);
114114
n_items.contents = 0;
115115
nodeC.contents = 1;
116-
return /* () */0;
116+
117117
}
118118

119119
function mkNode(low, v, high) {
@@ -335,7 +335,7 @@ function random(param) {
335335
function random_vars(n) {
336336
var vars = Caml_array.caml_make_vect(n, false);
337337
for(var i = 0 ,i_finish = n - 1 | 0; i <= i_finish; ++i){
338-
Caml_array.caml_array_set(vars, i, random(/* () */0));
338+
Caml_array.caml_array_set(vars, i, random(undefined));
339339
}
340340
return vars;
341341
}
@@ -372,7 +372,7 @@ function main(param) {
372372
succeeded = succeeded && test_hwb(bdd, random_vars(22));
373373
}
374374
if (succeeded) {
375-
return /* () */0;
375+
return ;
376376
}
377377
throw [
378378
Caml_builtin_exceptions.assert_failure,
@@ -384,7 +384,7 @@ function main(param) {
384384
];
385385
}
386386

387-
main(/* () */0);
387+
main(undefined);
388388

389389
var initSize_1 = 8191;
390390

jscomp/test/bench.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,10 @@ function f2(param) {
5656
return prim + prim$1;
5757
}), 0, b);
5858
console.log(Pervasives.string_of_float(v));
59-
return /* () */0;
59+
6060
}
6161

62-
f2(/* () */0);
62+
f2(undefined);
6363

6464
exports.map = map;
6565
exports.init = init;

jscomp/test/bigarray_test.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ function sum(v) {
88
for(var i = 0 ,i_finish = Caml_external_polyfill.resolve("caml_ba_dim_1")(v) - 1 | 0; i <= i_finish; ++i){
99
result = result + Caml_external_polyfill.resolve("caml_ba_get_1")(v, i) | 0;
1010
}
11-
return /* () */0;
11+
1212
}
1313

1414
function init(v) {
@@ -18,21 +18,21 @@ function init(v) {
1818
im: Caml_int32.imul(Caml_int32.imul(i, i), i)
1919
};
2020
}
21-
return /* () */0;
21+
2222
}
2323

2424
function init2(v) {
2525
for(var i = 0 ,i_finish = Caml_external_polyfill.resolve("caml_ba_dim_1")(v) - 1 | 0; i <= i_finish; ++i){
2626
v[i] = i;
2727
}
28-
return /* () */0;
28+
2929
}
3030

3131
function init3(v) {
3232
for(var i = 0 ,i_finish = Caml_external_polyfill.resolve("caml_ba_dim_1")(v) - 1 | 0; i <= i_finish; ++i){
3333
Caml_external_polyfill.resolve("caml_ba_set_1")(v, i, i);
3434
}
35-
return /* () */0;
35+
3636
}
3737

3838
var BA1 = /* alias */0;

jscomp/test/bs_MapInt_test.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@ var Belt_MapInt = require("../../lib/js/belt_MapInt.js");
66
function should(b) {
77
if (!b) {
88
return Js_exn.raiseError("IMPOSSIBLE");
9-
} else {
10-
return /* () */0;
119
}
10+
1211
}
1312

1413
function test(param) {
@@ -25,7 +24,7 @@ function test(param) {
2524
return should(Belt_MapInt.isEmpty(m));
2625
}
2726

28-
test(/* () */0);
27+
test(undefined);
2928

3029
var M = /* alias */0;
3130

jscomp/test/bs_array_test.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ function neq(loc, x, y) {
4646
],
4747
suites.contents
4848
];
49-
return /* () */0;
49+
5050
}
5151

5252
console.log([
@@ -86,15 +86,15 @@ $$throw("File \"bs_array_test.ml\", line 28, characters 8-15", (function (param)
8686
0,
8787
1
8888
], -1);
89-
return /* () */0;
89+
9090
}));
9191

9292
$$throw("File \"bs_array_test.ml\", line 29, characters 8-15", (function (param) {
9393
Belt_Array.getExn([
9494
0,
9595
1
9696
], 2);
97-
return /* () */0;
97+
9898
}));
9999

100100
var partial_arg = [
@@ -1174,7 +1174,7 @@ function sumUsingForEach(xs) {
11741174
};
11751175
Belt_Array.forEach(xs, (function (x) {
11761176
v.contents = v.contents + x | 0;
1177-
return /* () */0;
1177+
11781178
}));
11791179
return v.contents;
11801180
}
@@ -1231,7 +1231,7 @@ b("File \"bs_array_test.ml\", line 275, characters 4-11", (Belt_Array.forEachWit
12311231
1
12321232
], (function (i, v) {
12331233
c$1.contents = (c$1.contents + i | 0) + v | 0;
1234-
return /* () */0;
1234+
12351235
})), c$1.contents === 6));
12361236

12371237
function id$1(loc, x) {

0 commit comments

Comments
 (0)