Skip to content

Commit fbd64ab

Browse files
committed
snapshot js changes
1 parent dc42fcd commit fbd64ab

17 files changed

+286
-318
lines changed

jscomp/test/bb.js

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,12 @@
22

33

44
function f(x) {
5-
if (x !== 98) {
6-
if (x >= 99) {
7-
return "c";
8-
} else {
9-
return "a";
10-
}
11-
} else {
5+
if (x === /* b */98) {
126
return "b";
7+
} else if (x === /* c */99) {
8+
return "c";
9+
} else {
10+
return "a";
1311
}
1412
}
1513

@@ -57,14 +55,12 @@ function test(x) {
5755
Error: new Error()
5856
};
5957
}
60-
if (match !== 98) {
61-
if (match >= 99) {
62-
return "c";
63-
} else {
64-
return "a";
65-
}
66-
} else {
58+
if (match === /* b */98) {
6759
return "b";
60+
} else if (match === /* c */99) {
61+
return "c";
62+
} else {
63+
return "a";
6864
}
6965
}
7066

jscomp/test/const_test.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,12 @@ function fff(x) {
2626
}
2727

2828
function h(x) {
29-
if (x !== 66) {
30-
if (x >= 67) {
31-
return 2;
32-
} else {
33-
return 0;
34-
}
35-
} else {
29+
if (x === /* B */66) {
3630
return 1;
31+
} else if (x === /* C */67) {
32+
return 2;
33+
} else {
34+
return 0;
3735
}
3836
}
3937

jscomp/test/ext_filename_test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,8 @@ function chop_extension_if_any(fname) {
115115
var os_path_separator_char = Filename.dir_sep.charCodeAt(0);
116116

117117
function relative_path(file_or_dir_1, file_or_dir_2) {
118-
var relevant_dir1 = file_or_dir_1.HASH >= 781515420 ? Curry._1(Filename.dirname, file_or_dir_1.VAL) : file_or_dir_1.VAL;
119-
var relevant_dir2 = file_or_dir_2.HASH >= 781515420 ? Curry._1(Filename.dirname, file_or_dir_2.VAL) : file_or_dir_2.VAL;
118+
var relevant_dir1 = file_or_dir_1.HASH === /* File */781515420 ? Curry._1(Filename.dirname, file_or_dir_1.VAL) : file_or_dir_1.VAL;
119+
var relevant_dir2 = file_or_dir_2.HASH === /* File */781515420 ? Curry._1(Filename.dirname, file_or_dir_2.VAL) : file_or_dir_2.VAL;
120120
var dir1 = Ext_string_test.split(undefined, relevant_dir1, os_path_separator_char);
121121
var dir2 = Ext_string_test.split(undefined, relevant_dir2, os_path_separator_char);
122122
var go = function (_dir1, _dir2) {
@@ -149,13 +149,13 @@ function node_relative_path(node_modules_shorten, file1, dep_file) {
149149
var v = Ext_string_test.find(undefined, Test_literals.node_modules, file2);
150150
var len = file2.length;
151151
if (!(node_modules_shorten && v >= 0)) {
152-
return relative_path(dep_file.HASH >= 781515420 ? ({
152+
return relative_path(dep_file.HASH === /* File */781515420 ? ({
153153
HASH: /* File */781515420,
154154
VAL: absolute_path(dep_file.VAL)
155155
}) : ({
156156
HASH: /* Dir */3405101,
157157
VAL: absolute_path(dep_file.VAL)
158-
}), file1.HASH >= 781515420 ? ({
158+
}), file1.HASH === /* File */781515420 ? ({
159159
HASH: /* File */781515420,
160160
VAL: absolute_path(file1.VAL)
161161
}) : ({

jscomp/test/gpr_1891_test.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
var Curry = require("../../lib/js/curry.js");
44

55
function foo(x) {
6-
if (typeof x === "number" || x.HASH !== 3505894 || x.VAL !== 3) {
6+
if (typeof x === "number" || !(x.HASH === /* Foo */3505894 && x.VAL === 3)) {
77
console.log("2");
88
} else {
99
console.log("1");
@@ -12,31 +12,31 @@ function foo(x) {
1212
}
1313

1414
function foo2(x) {
15-
if (typeof x === "number" || x.HASH !== 3505894 || x.VAL !== 3) {
15+
if (typeof x === "number" || !(x.HASH === /* Foo */3505894 && x.VAL === 3)) {
1616
return "xxx";
1717
} else {
1818
return "xxxx";
1919
}
2020
}
2121

2222
function foo3(x) {
23-
if (typeof x === "number" || x.HASH !== 3505894 || x.VAL !== 3) {
23+
if (typeof x === "number" || !(x.HASH === /* Foo */3505894 && x.VAL === 3)) {
2424
return 2;
2525
} else {
2626
return 1;
2727
}
2828
}
2929

3030
function foo4(x, h) {
31-
if (typeof x === "number" || x.HASH !== 3505894 || x.VAL !== 3) {
31+
if (typeof x === "number" || !(x.HASH === /* Foo */3505894 && x.VAL === 3)) {
3232
return ;
3333
} else {
3434
return Curry._1(h, undefined);
3535
}
3636
}
3737

3838
function foo5(x) {
39-
if (typeof x === "number" || x.HASH !== 3505894 || x.VAL !== 3) {
39+
if (typeof x === "number" || !(x.HASH === /* Foo */3505894 && x.VAL === 3)) {
4040
console.log("x");
4141
} else {
4242
console.log("hi");

jscomp/test/gpr_4280_test.js

Lines changed: 22 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -35,29 +35,24 @@ function string(s) {
3535
}
3636

3737
function fn(authState, route) {
38-
var exit = 0;
3938
var onboardingRoute;
4039
if (typeof authState === "number") {
41-
var exit$1 = 0;
40+
var exit = 0;
4241
if (typeof route === "number") {
43-
if (route >= -730831382) {
44-
if (route !== -384135774 && route !== -384133096) {
45-
exit$1 = 3;
46-
} else {
47-
exit = 2;
48-
}
49-
} else if (route !== -799423340 && route < -730831383) {
50-
exit$1 = 3;
51-
} else {
52-
exit = 2;
42+
if (route === /* SignUp */-384133096 || route === /* SignIn */-384135774 || route === /* Invite */-730831383 || route === /* PasswordReset */-799423340) {
43+
div({
44+
hd: string("LoggedOut"),
45+
tl: /* [] */0
46+
}, undefined);
47+
return 1;
5348
}
54-
} else if (route.HASH !== 378129979) {
55-
exit$1 = 3;
56-
} else {
49+
exit = 2;
50+
} else if (route.HASH === /* Onboarding */378129979) {
5751
onboardingRoute = route.VAL;
58-
exit = 1;
52+
} else {
53+
exit = 2;
5954
}
60-
if (exit$1 === 3) {
55+
if (exit === 2) {
6156
div({
6257
hd: string("Redirect"),
6358
tl: /* [] */0
@@ -66,14 +61,13 @@ function fn(authState, route) {
6661
}
6762

6863
} else {
69-
var exit$2 = 0;
70-
if (typeof route === "number" || route.HASH !== 378129979) {
71-
exit$2 = 3;
64+
var exit$1 = 0;
65+
if (typeof route === "number" || route.HASH !== /* Onboarding */378129979) {
66+
exit$1 = 2;
7267
} else {
7368
onboardingRoute = route.VAL;
74-
exit = 1;
7569
}
76-
if (exit$2 === 3) {
70+
if (exit$1 === 2) {
7771
console.log(authState.VAL);
7872
div({
7973
hd: string("VerifyEmail"),
@@ -83,22 +77,12 @@ function fn(authState, route) {
8377
}
8478

8579
}
86-
switch (exit) {
87-
case 1 :
88-
console.log(onboardingRoute);
89-
div({
90-
hd: string("Onboarding"),
91-
tl: /* [] */0
92-
}, undefined);
93-
return 0;
94-
case 2 :
95-
div({
96-
hd: string("LoggedOut"),
97-
tl: /* [] */0
98-
}, undefined);
99-
return 1;
100-
101-
}
80+
console.log(onboardingRoute);
81+
div({
82+
hd: string("Onboarding"),
83+
tl: /* [] */0
84+
}, undefined);
85+
return 0;
10286
}
10387

10488
eq("File \"gpr_4280_test.ml\", line 46, characters 6-13", fn(/* Unauthenticated */-54822762, /* Invite */-730831383), 1);

jscomp/test/more_poly_variant_test.js

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ function map(f, param) {
1616
}
1717

1818
function split_cases(x) {
19-
if (typeof x === "number" || x.HASH < 925929103) {
19+
if (typeof x === "number" || x.HASH !== /* Snoc */925929103) {
2020
return {
2121
HASH: /* A */65,
2222
VAL: x
@@ -38,7 +38,7 @@ function f(param) {
3838
}
3939

4040
function g1(param) {
41-
if (param.HASH >= 936370360) {
41+
if (param.HASH === /* Tag2 */936370360) {
4242
return "Tag2";
4343
} else {
4444
return "Tag1";
@@ -54,7 +54,7 @@ function g(x) {
5454
}
5555

5656
function f1(param) {
57-
if (param >= 14610) {
57+
if (param === /* As */14610) {
5858
return "A";
5959
} else {
6060
return "other";
@@ -63,14 +63,12 @@ function f1(param) {
6363

6464
function f2(x) {
6565
if (typeof x === "number") {
66-
if (x >= 616641298) {
67-
if (x >= 936370362) {
68-
console.log(x);
69-
return 2;
70-
} else {
71-
return 3;
72-
}
73-
} else if (x >= 104) {
66+
if (x === /* h */104) {
67+
return 2;
68+
} else if (x === /* hello */616641298) {
69+
return 3;
70+
} else if (x === /* Tag4 */936370362) {
71+
console.log(x);
7472
return 2;
7573
} else {
7674
return 333;

jscomp/test/ocaml_parsetree_test.js

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11149,29 +11149,28 @@ function directive_parse(token_with_comments, lexbuf) {
1114911149
var pred = match[0];
1115011150
var match$1 = semantic_version_parse(lhs$1, 0, lhs$1.length - 1 | 0);
1115111151
var lversion = match$1[0];
11152+
if (pred === /* Ge */15934) {
11153+
return Caml_obj.caml_greaterequal(lversion, version);
11154+
}
11155+
if (pred === /* Gt */15949) {
11156+
return Caml_obj.caml_greaterthan(lversion, version);
11157+
}
11158+
if (pred === /* Le */17049) {
11159+
return Caml_obj.caml_lessequal(lversion, version);
11160+
}
11161+
if (pred === /* Lt */17064) {
11162+
return Caml_obj.caml_lessthan(lversion, version);
11163+
}
11164+
if (pred === /* Exact */172069535) {
11165+
return Caml_obj.caml_equal(lversion, version);
11166+
}
1115211167
var l_major = lversion[0];
11153-
if (pred >= 17049) {
11154-
if (pred >= 172069535) {
11155-
if (pred >= 785637236) {
11156-
return major === l_major;
11157-
} else {
11158-
return Caml_obj.caml_equal(lversion, version);
11159-
}
11160-
} else if (pred >= 17064) {
11161-
return Caml_obj.caml_lessthan(lversion, version);
11162-
} else {
11163-
return Caml_obj.caml_lessequal(lversion, version);
11164-
}
11165-
} else if (pred !== 15934) {
11166-
if (pred >= 15949) {
11167-
return Caml_obj.caml_greaterthan(lversion, version);
11168-
} else if (major === l_major) {
11169-
return version[1] === lversion[1];
11170-
} else {
11171-
return false;
11172-
}
11168+
if (pred === /* Compatible */785637236) {
11169+
return major === l_major;
11170+
} else if (major === l_major) {
11171+
return version[1] === lversion[1];
1117311172
} else {
11174-
return Caml_obj.caml_greaterequal(lversion, version);
11173+
return false;
1117511174
}
1117611175
}
1117711176
exit$2 = 3;

0 commit comments

Comments
 (0)