Skip to content

Commit 6933509

Browse files
committed
snapshot js changes
1 parent 16e4ef4 commit 6933509

File tree

2 files changed

+76
-34
lines changed

2 files changed

+76
-34
lines changed

Diff for: jscomp/test/bs_list_test.js

+50-34
Original file line numberDiff line numberDiff line change
@@ -1797,7 +1797,23 @@ b("File \"bs_list_test.ml\", line 267, characters 4-11", Caml_obj.caml_equal(Bel
17971797
]
17981798
]));
17991799

1800-
b("File \"bs_list_test.ml\", line 268, characters 4-11", Belt_List.reduceReverse2(/* :: */[
1800+
b("File \"bs_list_test.ml\", line 268, characters 4-11", Belt_List.reduceWithIndex(/* :: */[
1801+
1,
1802+
/* :: */[
1803+
2,
1804+
/* :: */[
1805+
3,
1806+
/* :: */[
1807+
4,
1808+
/* [] */0
1809+
]
1810+
]
1811+
]
1812+
], 0, (function (acc, x, i) {
1813+
return (acc + x | 0) + i | 0;
1814+
})) === 16);
1815+
1816+
b("File \"bs_list_test.ml\", line 269, characters 4-11", Belt_List.reduceReverse2(/* :: */[
18011817
1,
18021818
/* :: */[
18031819
2,
@@ -1820,21 +1836,21 @@ var a$1 = Belt_List.makeBy(10000, (function (i) {
18201836
return i;
18211837
}));
18221838

1823-
b("File \"bs_list_test.ml\", line 271, characters 4-11", Belt_List.reduceReverse2(a$1, /* :: */[
1839+
b("File \"bs_list_test.ml\", line 272, characters 4-11", Belt_List.reduceReverse2(a$1, /* :: */[
18241840
0,
18251841
a$1
18261842
], 0, (function (acc, x, y) {
18271843
return (acc + x | 0) + y | 0;
18281844
})) === 99980001);
18291845

1830-
eq("File \"bs_list_test.ml\", line 277, characters 5-12", Belt_List.every2(/* [] */0, /* :: */[
1846+
eq("File \"bs_list_test.ml\", line 278, characters 5-12", Belt_List.every2(/* [] */0, /* :: */[
18311847
1,
18321848
/* [] */0
18331849
], (function (x, y) {
18341850
return x > y;
18351851
})), true);
18361852

1837-
eq("File \"bs_list_test.ml\", line 278, characters 5-12", Belt_List.every2(/* :: */[
1853+
eq("File \"bs_list_test.ml\", line 279, characters 5-12", Belt_List.every2(/* :: */[
18381854
2,
18391855
/* :: */[
18401856
3,
@@ -1847,7 +1863,7 @@ eq("File \"bs_list_test.ml\", line 278, characters 5-12", Belt_List.every2(/* ::
18471863
return x > y;
18481864
})), true);
18491865

1850-
eq("File \"bs_list_test.ml\", line 279, characters 5-12", Belt_List.every2(/* :: */[
1866+
eq("File \"bs_list_test.ml\", line 280, characters 5-12", Belt_List.every2(/* :: */[
18511867
2,
18521868
/* [] */0
18531869
], /* :: */[
@@ -1857,7 +1873,7 @@ eq("File \"bs_list_test.ml\", line 279, characters 5-12", Belt_List.every2(/* ::
18571873
return x > y;
18581874
})), true);
18591875

1860-
eq("File \"bs_list_test.ml\", line 280, characters 5-12", Belt_List.every2(/* :: */[
1876+
eq("File \"bs_list_test.ml\", line 281, characters 5-12", Belt_List.every2(/* :: */[
18611877
2,
18621878
/* :: */[
18631879
3,
@@ -1873,7 +1889,7 @@ eq("File \"bs_list_test.ml\", line 280, characters 5-12", Belt_List.every2(/* ::
18731889
return x > y;
18741890
})), false);
18751891

1876-
eq("File \"bs_list_test.ml\", line 281, characters 5-12", Belt_List.every2(/* :: */[
1892+
eq("File \"bs_list_test.ml\", line 282, characters 5-12", Belt_List.every2(/* :: */[
18771893
2,
18781894
/* :: */[
18791895
3,
@@ -1889,14 +1905,14 @@ eq("File \"bs_list_test.ml\", line 281, characters 5-12", Belt_List.every2(/* ::
18891905
return x > y;
18901906
})), true);
18911907

1892-
eq("File \"bs_list_test.ml\", line 282, characters 5-12", Belt_List.some2(/* [] */0, /* :: */[
1908+
eq("File \"bs_list_test.ml\", line 283, characters 5-12", Belt_List.some2(/* [] */0, /* :: */[
18931909
1,
18941910
/* [] */0
18951911
], (function (x, y) {
18961912
return x > y;
18971913
})), false);
18981914

1899-
eq("File \"bs_list_test.ml\", line 283, characters 5-12", Belt_List.some2(/* :: */[
1915+
eq("File \"bs_list_test.ml\", line 284, characters 5-12", Belt_List.some2(/* :: */[
19001916
2,
19011917
/* :: */[
19021918
3,
@@ -1909,7 +1925,7 @@ eq("File \"bs_list_test.ml\", line 283, characters 5-12", Belt_List.some2(/* ::
19091925
return x > y;
19101926
})), true);
19111927

1912-
eq("File \"bs_list_test.ml\", line 284, characters 5-12", Belt_List.some2(/* :: */[
1928+
eq("File \"bs_list_test.ml\", line 285, characters 5-12", Belt_List.some2(/* :: */[
19131929
2,
19141930
/* :: */[
19151931
3,
@@ -1925,7 +1941,7 @@ eq("File \"bs_list_test.ml\", line 284, characters 5-12", Belt_List.some2(/* ::
19251941
return x > y;
19261942
})), true);
19271943

1928-
eq("File \"bs_list_test.ml\", line 285, characters 5-12", Belt_List.some2(/* :: */[
1944+
eq("File \"bs_list_test.ml\", line 286, characters 5-12", Belt_List.some2(/* :: */[
19291945
0,
19301946
/* :: */[
19311947
3,
@@ -1941,7 +1957,7 @@ eq("File \"bs_list_test.ml\", line 285, characters 5-12", Belt_List.some2(/* ::
19411957
return x > y;
19421958
})), false);
19431959

1944-
eq("File \"bs_list_test.ml\", line 286, characters 5-12", Belt_List.some2(/* :: */[
1960+
eq("File \"bs_list_test.ml\", line 287, characters 5-12", Belt_List.some2(/* :: */[
19451961
0,
19461962
/* :: */[
19471963
3,
@@ -1957,7 +1973,7 @@ eq("File \"bs_list_test.ml\", line 286, characters 5-12", Belt_List.some2(/* ::
19571973
return x > y;
19581974
})), true);
19591975

1960-
eq("File \"bs_list_test.ml\", line 287, characters 5-12", Belt_List.some2(/* :: */[
1976+
eq("File \"bs_list_test.ml\", line 288, characters 5-12", Belt_List.some2(/* :: */[
19611977
1,
19621978
/* :: */[
19631979
2,
@@ -1977,12 +1993,12 @@ eq("File \"bs_list_test.ml\", line 287, characters 5-12", Belt_List.some2(/* ::
19771993
})), false);
19781994

19791995
function makeTest(n) {
1980-
return eq("File \"bs_list_test.ml\", line 290, characters 5-12", Belt_List.make(n, 3), Belt_List.makeBy(n, (function () {
1996+
return eq("File \"bs_list_test.ml\", line 291, characters 5-12", Belt_List.make(n, 3), Belt_List.makeBy(n, (function () {
19811997
return 3;
19821998
})));
19831999
}
19842000

1985-
eq("File \"bs_list_test.ml\", line 293, characters 5-12", /* :: */[
2001+
eq("File \"bs_list_test.ml\", line 294, characters 5-12", /* :: */[
19862002
2,
19872003
/* :: */[
19882004
3,
@@ -1996,7 +2012,7 @@ eq("File \"bs_list_test.ml\", line 293, characters 5-12", /* :: */[
19962012
]
19972013
]);
19982014

1999-
b("File \"bs_list_test.ml\", line 299, characters 4-11", Belt_List.cmp(/* :: */[
2015+
b("File \"bs_list_test.ml\", line 300, characters 4-11", Belt_List.cmp(/* :: */[
20002016
1,
20012017
/* :: */[
20022018
2,
@@ -2019,7 +2035,7 @@ b("File \"bs_list_test.ml\", line 299, characters 4-11", Belt_List.cmp(/* :: */[
20192035
]
20202036
], Caml_obj.caml_compare) > 0);
20212037

2022-
b("File \"bs_list_test.ml\", line 300, characters 4-11", Belt_List.cmp(/* :: */[
2038+
b("File \"bs_list_test.ml\", line 301, characters 4-11", Belt_List.cmp(/* :: */[
20232039
1,
20242040
/* :: */[
20252041
2,
@@ -2042,7 +2058,7 @@ b("File \"bs_list_test.ml\", line 300, characters 4-11", Belt_List.cmp(/* :: */[
20422058
]
20432059
], Caml_obj.caml_compare) > 0);
20442060

2045-
b("File \"bs_list_test.ml\", line 301, characters 4-11", Belt_List.cmp(/* :: */[
2061+
b("File \"bs_list_test.ml\", line 302, characters 4-11", Belt_List.cmp(/* :: */[
20462062
1,
20472063
/* :: */[
20482064
2,
@@ -2065,7 +2081,7 @@ b("File \"bs_list_test.ml\", line 301, characters 4-11", Belt_List.cmp(/* :: */[
20652081
]
20662082
], Caml_obj.caml_compare) < 0);
20672083

2068-
b("File \"bs_list_test.ml\", line 302, characters 4-11", Belt_List.cmp(/* :: */[
2084+
b("File \"bs_list_test.ml\", line 303, characters 4-11", Belt_List.cmp(/* :: */[
20692085
1,
20702086
/* :: */[
20712087
2,
@@ -2085,7 +2101,7 @@ b("File \"bs_list_test.ml\", line 302, characters 4-11", Belt_List.cmp(/* :: */[
20852101
]
20862102
], Caml_primitive.caml_int_compare) > 0);
20872103

2088-
b("File \"bs_list_test.ml\", line 303, characters 4-11", Belt_List.cmp(/* :: */[
2104+
b("File \"bs_list_test.ml\", line 304, characters 4-11", Belt_List.cmp(/* :: */[
20892105
1,
20902106
/* :: */[
20912107
2,
@@ -2105,7 +2121,7 @@ b("File \"bs_list_test.ml\", line 303, characters 4-11", Belt_List.cmp(/* :: */[
21052121
]
21062122
], Caml_primitive.caml_int_compare) === 0);
21072123

2108-
b("File \"bs_list_test.ml\", line 304, characters 4-11", Belt_List.cmp(/* :: */[
2124+
b("File \"bs_list_test.ml\", line 305, characters 4-11", Belt_List.cmp(/* :: */[
21092125
1,
21102126
/* :: */[
21112127
2,
@@ -2125,19 +2141,19 @@ b("File \"bs_list_test.ml\", line 304, characters 4-11", Belt_List.cmp(/* :: */[
21252141
]
21262142
], Caml_primitive.caml_int_compare) > 0);
21272143

2128-
b("File \"bs_list_test.ml\", line 305, characters 4-11", Belt_List.cmpByLength(/* [] */0, /* [] */0) === 0);
2144+
b("File \"bs_list_test.ml\", line 306, characters 4-11", Belt_List.cmpByLength(/* [] */0, /* [] */0) === 0);
21292145

2130-
b("File \"bs_list_test.ml\", line 306, characters 4-11", Belt_List.cmpByLength(/* :: */[
2146+
b("File \"bs_list_test.ml\", line 307, characters 4-11", Belt_List.cmpByLength(/* :: */[
21312147
1,
21322148
/* [] */0
21332149
], /* [] */0) > 0);
21342150

2135-
b("File \"bs_list_test.ml\", line 307, characters 4-11", Belt_List.cmpByLength(/* [] */0, /* :: */[
2151+
b("File \"bs_list_test.ml\", line 308, characters 4-11", Belt_List.cmpByLength(/* [] */0, /* :: */[
21362152
1,
21372153
/* [] */0
21382154
]) < 0);
21392155

2140-
b("File \"bs_list_test.ml\", line 308, characters 4-11", Belt_List.cmpByLength(/* :: */[
2156+
b("File \"bs_list_test.ml\", line 309, characters 4-11", Belt_List.cmpByLength(/* :: */[
21412157
1,
21422158
/* :: */[
21432159
2,
@@ -2148,7 +2164,7 @@ b("File \"bs_list_test.ml\", line 308, characters 4-11", Belt_List.cmpByLength(/
21482164
/* [] */0
21492165
]) > 0);
21502166

2151-
b("File \"bs_list_test.ml\", line 309, characters 4-11", Belt_List.cmpByLength(/* :: */[
2167+
b("File \"bs_list_test.ml\", line 310, characters 4-11", Belt_List.cmpByLength(/* :: */[
21522168
1,
21532169
/* [] */0
21542170
], /* :: */[
@@ -2159,7 +2175,7 @@ b("File \"bs_list_test.ml\", line 309, characters 4-11", Belt_List.cmpByLength(/
21592175
]
21602176
]) < 0);
21612177

2162-
b("File \"bs_list_test.ml\", line 310, characters 4-11", Belt_List.cmpByLength(/* :: */[
2178+
b("File \"bs_list_test.ml\", line 311, characters 4-11", Belt_List.cmpByLength(/* :: */[
21632179
1,
21642180
/* :: */[
21652181
3,
@@ -2243,7 +2259,7 @@ eq("SORT", Belt_List.sort(/* :: */[
22432259
]
22442260
]);
22452261

2246-
b("File \"bs_list_test.ml\", line 326, characters 4-11", !Belt_List.eq(/* :: */[
2262+
b("File \"bs_list_test.ml\", line 327, characters 4-11", !Belt_List.eq(/* :: */[
22472263
1,
22482264
/* :: */[
22492265
2,
@@ -2262,7 +2278,7 @@ b("File \"bs_list_test.ml\", line 326, characters 4-11", !Belt_List.eq(/* :: */[
22622278
return x === y;
22632279
})));
22642280

2265-
b("File \"bs_list_test.ml\", line 327, characters 4-11", Belt_List.eq(/* :: */[
2281+
b("File \"bs_list_test.ml\", line 328, characters 4-11", Belt_List.eq(/* :: */[
22662282
1,
22672283
/* :: */[
22682284
2,
@@ -2284,7 +2300,7 @@ b("File \"bs_list_test.ml\", line 327, characters 4-11", Belt_List.eq(/* :: */[
22842300
return x === y;
22852301
})));
22862302

2287-
b("File \"bs_list_test.ml\", line 328, characters 4-11", !Belt_List.eq(/* :: */[
2303+
b("File \"bs_list_test.ml\", line 329, characters 4-11", !Belt_List.eq(/* :: */[
22882304
1,
22892305
/* :: */[
22902306
2,
@@ -2306,7 +2322,7 @@ b("File \"bs_list_test.ml\", line 328, characters 4-11", !Belt_List.eq(/* :: */[
23062322
return x === y;
23072323
})));
23082324

2309-
b("File \"bs_list_test.ml\", line 329, characters 4-11", !Belt_List.eq(/* :: */[
2325+
b("File \"bs_list_test.ml\", line 330, characters 4-11", !Belt_List.eq(/* :: */[
23102326
1,
23112327
/* :: */[
23122328
2,
@@ -2340,7 +2356,7 @@ var u1 = Belt_List.keepMap(u0, (function (x) {
23402356

23412357
}));
23422358

2343-
eq("File \"bs_list_test.ml\", line 333, characters 5-12", u1, /* :: */[
2359+
eq("File \"bs_list_test.ml\", line 334, characters 5-12", u1, /* :: */[
23442360
1,
23452361
/* :: */[
23462362
8,
@@ -2351,7 +2367,7 @@ eq("File \"bs_list_test.ml\", line 333, characters 5-12", u1, /* :: */[
23512367
]
23522368
]);
23532369

2354-
b("File \"bs_list_test.ml\", line 334, characters 4-11", Caml_obj.caml_equal(Belt_List.keepMap(/* :: */[
2370+
b("File \"bs_list_test.ml\", line 335, characters 4-11", Caml_obj.caml_equal(Belt_List.keepMap(/* :: */[
23552371
1,
23562372
/* :: */[
23572373
2,
@@ -2376,7 +2392,7 @@ b("File \"bs_list_test.ml\", line 334, characters 4-11", Caml_obj.caml_equal(Bel
23762392
]
23772393
]));
23782394

2379-
b("File \"bs_list_test.ml\", line 338, characters 4-11", Belt_List.keepMap(/* :: */[
2395+
b("File \"bs_list_test.ml\", line 339, characters 4-11", Belt_List.keepMap(/* :: */[
23802396
1,
23812397
/* :: */[
23822398
2,

Diff for: lib/js/belt_List.js

+26
Original file line numberDiff line numberDiff line change
@@ -832,6 +832,30 @@ function reduceReverse(l, accu, f) {
832832
return reduceReverseU(l, accu, Curry.__2(f));
833833
}
834834

835+
function reduceWithIndexU(l, acc, f) {
836+
var _l = l;
837+
var _acc = acc;
838+
var f$1 = f;
839+
var _i = 0;
840+
while(true) {
841+
var i = _i;
842+
var acc$1 = _acc;
843+
var l$1 = _l;
844+
if (l$1) {
845+
_i = i + 1 | 0;
846+
_acc = f$1(acc$1, l$1[0], i);
847+
_l = l$1[1];
848+
continue ;
849+
} else {
850+
return acc$1;
851+
}
852+
};
853+
}
854+
855+
function reduceWithIndex(l, acc, f) {
856+
return reduceWithIndexU(l, acc, Curry.__3(f));
857+
}
858+
835859
function mapReverse2U(l1, l2, f) {
836860
var _l1 = l1;
837861
var _l2 = l2;
@@ -1410,6 +1434,8 @@ exports.forEachWithIndexU = forEachWithIndexU;
14101434
exports.forEachWithIndex = forEachWithIndex;
14111435
exports.reduceU = reduceU;
14121436
exports.reduce = reduce;
1437+
exports.reduceWithIndexU = reduceWithIndexU;
1438+
exports.reduceWithIndex = reduceWithIndex;
14131439
exports.reduceReverseU = reduceReverseU;
14141440
exports.reduceReverse = reduceReverse;
14151441
exports.mapReverse2U = mapReverse2U;

0 commit comments

Comments
 (0)