forked from rescript-lang/rescript
-
Notifications
You must be signed in to change notification settings - Fork 0
/
adt_optimize_test.js
184 lines (164 loc) · 2.7 KB
/
adt_optimize_test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
'use strict';
var Caml_builtin_exceptions = require("../../lib/js/caml_builtin_exceptions.js");
function f(x) {
return x + 1 | 0;
}
function f_0(x) {
return x - 1 | 0;
}
function f2(param) {
if (param >= 3) {
return /* T003 */3;
} else {
return param;
}
}
function f3(param) {
return param;
}
function f4() {
return 3;
}
function f5(param) {
if (typeof param === "number") {
switch (param) {
case 0 :
return 1;
case 1 :
return 3;
case 2 :
return 4;
}
} else {
switch (param.tag | 0) {
case 0 :
case 1 :
return 1;
case 2 :
return 2;
}
}
}
function f6(param) {
if (typeof param === "number") {
if (param >= 2) {
return 2;
} else {
return 0;
}
} else {
return 1;
}
}
function f7(param) {
if (typeof param === "number") {
switch (param) {
case 0 :
return 1;
case 1 :
return 2;
case 2 :
return -1;
}
} else {
switch (param.tag | 0) {
case 0 :
return 3;
case 1 :
return 4;
case 2 :
return -1;
}
}
}
function f8(param) {
if (typeof param === "number") {
switch (param) {
case 0 :
case 1 :
return 1;
default:
return 3;
}
} else {
switch (param.tag | 0) {
case 0 :
case 1 :
return 2;
default:
return 3;
}
}
}
function f9(param) {
if (typeof param === "number") {
switch (param) {
case 0 :
case 1 :
case 2 :
return 1;
default:
return 3;
}
} else {
switch (param.tag | 0) {
case 0 :
case 1 :
return 2;
default:
return 3;
}
}
}
function f10(param) {
if (typeof param === "number") {
switch (param) {
case 0 :
return 0;
case 1 :
return 2;
case 2 :
return 4;
case 3 :
return 1;
}
} else {
switch (param.tag | 0) {
case 0 :
case 1 :
return 2;
case 2 :
case 3 :
return 3;
}
}
}
function f11(x) {
if (typeof x === "number") {
return 2;
} else if (x.tag) {
throw [
Caml_builtin_exceptions.assert_failure,
[
"adt_optimize_test.ml",
155,
9
]
];
} else {
return 1;
}
}
exports.f = f;
exports.f_0 = f_0;
exports.f2 = f2;
exports.f3 = f3;
exports.f4 = f4;
exports.f5 = f5;
exports.f6 = f6;
exports.f7 = f7;
exports.f8 = f8;
exports.f9 = f9;
exports.f10 = f10;
exports.f11 = f11;
/* No side effect */