forked from rescript-lang/rescript
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ast_js_mapper_test.js
109 lines (94 loc) · 1.71 KB
/
ast_js_mapper_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
'use strict';
var Js_mapperRt = require("../../lib/js/js_mapperRt.js");
function tToJs(param) {
return {
xx: param[/* xx */0],
yy: param[/* yy */1],
zz: param[/* zz */2]
};
}
function tFromJs(param) {
return /* record */[
/* xx */param.xx,
/* yy */param.yy,
/* zz */param.zz
];
}
var u = tToJs(/* record */[
/* xx */3,
/* yy */"x",
/* zz : tuple */[
1,
2
]
]);
tFromJs(u);
tFromJs({
xx: 3,
yy: "2",
zz: /* tuple */[
1,
2
],
cc: 3
});
function searchForSureExists(xs, k) {
var _i = 0;
var xs$1 = xs;
var k$1 = k;
while(true) {
var i = _i;
var match = xs$1[i];
if (match[0] === k$1) {
return match[1];
} else {
_i = i + 1 | 0;
continue ;
}
};
}
var jsMapperConstantArray = /* array */[
0,
3,
4,
5
];
function aToJs(param) {
return jsMapperConstantArray[param];
}
function aFromJs(param) {
return Js_mapperRt.fromIntAssert(4, jsMapperConstantArray, param);
}
var jsMapperConstantArray$1 = /* array */[
/* tuple */[
21902,
"b0"
],
/* tuple */[
21903,
"b1"
],
/* tuple */[
21904,
"b2"
],
/* tuple */[
21905,
"b3"
]
];
function bToJs(param) {
return Js_mapperRt.binarySearch(4, param, jsMapperConstantArray$1);
}
function bFromJs(param) {
return Js_mapperRt.revSearchAssert(4, jsMapperConstantArray$1, param);
}
bToJs(/* b0 */21902);
exports.tToJs = tToJs;
exports.tFromJs = tFromJs;
exports.searchForSureExists = searchForSureExists;
exports.aToJs = aToJs;
exports.aFromJs = aFromJs;
exports.bToJs = bToJs;
exports.bFromJs = bFromJs;
/* u Not a pure module */