Skip to content

Commit 47bba56

Browse files
committed
snapshot generated code
1 parent 44c2d4f commit 47bba56

Some content is hidden

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

57 files changed

+10416
-11960
lines changed

jscomp/test/caml_format_test.js

+22-27
Original file line numberDiff line numberDiff line change
@@ -1425,7 +1425,6 @@ function kwd(ppf, s) {
14251425
}
14261426

14271427
function pr_exp0(ppf, lam) {
1428-
var exit = 0;
14291428
switch (lam.tag | 0) {
14301429
case 1 :
14311430
return Curry._2(Format.fprintf(ppf, /* Format */[
@@ -1434,35 +1433,31 @@ function pr_exp0(ppf, lam) {
14341433
]), ident, lam[0]);
14351434
case 0 :
14361435
case 2 :
1437-
exit = 1;
14381436
break;
14391437

14401438
}
1441-
if (exit === 1) {
1442-
return Curry._2(Format.fprintf(ppf, /* Format */[
1443-
/* Formatting_gen */Block.__(18, [
1444-
/* Open_box */Block.__(1, [/* Format */[
1445-
/* String_literal */Block.__(11, [
1446-
"<1>",
1447-
/* End_of_format */0
1448-
]),
1449-
"<1>"
1450-
]]),
1451-
/* Char_literal */Block.__(12, [
1452-
/* "(" */40,
1453-
/* Alpha */Block.__(15, [/* Char_literal */Block.__(12, [
1454-
/* ")" */41,
1455-
/* Formatting_lit */Block.__(17, [
1456-
/* Close_box */0,
1457-
/* End_of_format */0
1458-
])
1459-
])])
1460-
])
1461-
]),
1462-
"@[<1>(%a)@]"
1463-
]), pr_lambda, lam);
1464-
}
1465-
1439+
return Curry._2(Format.fprintf(ppf, /* Format */[
1440+
/* Formatting_gen */Block.__(18, [
1441+
/* Open_box */Block.__(1, [/* Format */[
1442+
/* String_literal */Block.__(11, [
1443+
"<1>",
1444+
/* End_of_format */0
1445+
]),
1446+
"<1>"
1447+
]]),
1448+
/* Char_literal */Block.__(12, [
1449+
/* "(" */40,
1450+
/* Alpha */Block.__(15, [/* Char_literal */Block.__(12, [
1451+
/* ")" */41,
1452+
/* Formatting_lit */Block.__(17, [
1453+
/* Close_box */0,
1454+
/* End_of_format */0
1455+
])
1456+
])])
1457+
])
1458+
]),
1459+
"@[<1>(%a)@]"
1460+
]), pr_lambda, lam);
14661461
}
14671462

14681463
function pr_app(ppf, e) {

jscomp/test/custom_error_test.js

+2-12
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,9 @@ var Caml_option = require("../../lib/js/caml_option.js");
55
var Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js");
66

77
function test_js_error(param) {
8-
var exit = 0;
98
var e;
109
try {
1110
e = JSON.parse(" {\"x\" : }");
12-
exit = 1;
1311
}
1412
catch (raw_exn){
1513
var exn = Caml_js_exceptions.internalToOCamlException(raw_exn);
@@ -20,10 +18,7 @@ function test_js_error(param) {
2018
throw exn;
2119
}
2220
}
23-
if (exit === 1) {
24-
return Caml_option.some(e);
25-
}
26-
21+
return Caml_option.some(e);
2722
}
2823

2924
function test_js_error2(param) {
@@ -42,11 +37,9 @@ function test_js_error2(param) {
4237
}
4338

4439
function example1(param) {
45-
var exit = 0;
4640
var v;
4741
try {
4842
v = JSON.parse(" {\"x\" }");
49-
exit = 1;
5043
}
5144
catch (raw_exn){
5245
var exn = Caml_js_exceptions.internalToOCamlException(raw_exn);
@@ -57,10 +50,7 @@ function example1(param) {
5750
throw exn;
5851
}
5952
}
60-
if (exit === 1) {
61-
return Caml_option.some(v);
62-
}
63-
53+
return Caml_option.some(v);
6454
}
6555

6656
function example2(param) {

jscomp/test/exception_raise_test.js

+43-19
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
'use strict';
22

33
var Mt = require("./mt.js");
4+
var List = require("../../lib/js/list.js");
45
var Block = require("../../lib/js/block.js");
56
var Curry = require("../../lib/js/curry.js");
67
var Js_exn = require("../../lib/js/js_exn.js");
8+
var Pervasives = require("../../lib/js/pervasives.js");
79
var Caml_exceptions = require("../../lib/js/caml_exceptions.js");
810
var Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js");
911
var Caml_builtin_exceptions = require("../../lib/js/caml_builtin_exceptions.js");
@@ -23,7 +25,6 @@ function appf(g, x) {
2325
}
2426
catch (raw_exn){
2527
var exn = Caml_js_exceptions.internalToOCamlException(raw_exn);
26-
var exit = 0;
2728
if (exn === Local) {
2829
return 3;
2930
} else if (exn === Caml_builtin_exceptions.not_found) {
@@ -38,28 +39,20 @@ function appf(g, x) {
3839
var match$2 = match$1[1];
3940
if (match$2) {
4041
return match$2[0];
41-
} else {
42-
exit = 1;
4342
}
44-
} else {
45-
exit = 1;
43+
4644
}
47-
} else {
48-
exit = 1;
45+
4946
}
50-
} else {
51-
exit = 1;
47+
5248
}
53-
if (exit === 1) {
54-
if (exn[0] === C) {
55-
return exn[1];
56-
} else if (exn[0] === D) {
57-
return exn[1][0];
58-
} else {
59-
return 4;
60-
}
49+
if (exn[0] === C) {
50+
return exn[1];
51+
} else if (exn[0] === D) {
52+
return exn[1][0];
53+
} else {
54+
return 4;
6155
}
62-
6356
}
6457
}
6558

@@ -201,7 +194,36 @@ catch (raw_e$3){
201194
eq("File \"exception_raise_test.ml\", line 138, characters 7-14", Caml_js_exceptions.caml_as_js_exn(e$1) !== undefined, false);
202195
}
203196

204-
eq("File \"exception_raise_test.ml\", line 141, characters 5-12", function (a,b,c,_){return a + b + c }(1, 2, 3, 4), 6);
197+
function fff0(x, g) {
198+
var val;
199+
try {
200+
val = Curry._1(x, /* () */0);
201+
}
202+
catch (exn){
203+
return 1;
204+
}
205+
return Curry._1(g, /* () */0);
206+
}
207+
208+
function input_lines(ic, _acc) {
209+
while(true) {
210+
var acc = _acc;
211+
var line;
212+
try {
213+
line = Pervasives.input_line(ic);
214+
}
215+
catch (exn){
216+
return List.rev(acc);
217+
}
218+
_acc = /* :: */[
219+
line,
220+
acc
221+
];
222+
continue ;
223+
};
224+
}
225+
226+
eq("File \"exception_raise_test.ml\", line 150, characters 5-12", function (a,b,c,_){return a + b + c }(1, 2, 3, 4), 6);
205227

206228
Mt.from_pair_suites("Exception_raise_test", suites[0]);
207229

@@ -220,4 +242,6 @@ exports.a2 = a2;
220242
exports.suites = suites;
221243
exports.test_id = test_id;
222244
exports.eq = eq;
245+
exports.fff0 = fff0;
246+
exports.input_lines = input_lines;
223247
/* f Not a pure module */

jscomp/test/exception_raise_test.ml

+9
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,15 @@ let () =
137137
e ->
138138
eq __LOC__ (Js.Exn.asJsExn e <> None) false
139139

140+
141+
let fff0 x g = match x () with | exception _ -> 1 | _ -> g ()
142+
143+
let rec input_lines ic acc =
144+
match input_line ic with
145+
| exception _ -> List.rev acc
146+
| line -> input_lines ic (line::acc)
147+
148+
140149
let () =
141150
eq __LOC__ ((fun%raw a b c _ -> {|return a + b + c |} : _ -> _ -> _ -> _ -> _ ) 1 2 3 4) 6
142151
;; Mt.from_pair_suites __MODULE__ !suites

jscomp/test/exception_rebound_err_test.js

+14-16
Original file line numberDiff line numberDiff line change
@@ -42,31 +42,29 @@ function test_js_error4(param) {
4242
catch (raw_e){
4343
var e = Caml_js_exceptions.internalToOCamlException(raw_e);
4444
var exit = 0;
45-
var exit$1 = 0;
4645
if (e === Caml_builtin_exceptions.not_found) {
4746
return 2;
4847
} else if (e[0] === Caml_builtin_exceptions.invalid_argument && e[1] === "x") {
4948
return 3;
5049
} else {
51-
exit$1 = 2;
50+
exit = 2;
5251
}
53-
if (exit$1 === 2) {
54-
if (e[0] === A && e[1] === 2) {
55-
return 4;
56-
} else {
57-
exit = 1;
52+
if (exit === 2) {
53+
if (e[0] === A) {
54+
if (e[1] === 2) {
55+
return 4;
56+
}
57+
5858
}
59+
5960
}
60-
if (exit === 1) {
61-
if (e === B) {
62-
return 5;
63-
} else if (e[0] === C && !(e[1] !== 1 || e[2] !== 2)) {
64-
return 6;
65-
} else {
66-
return 7;
67-
}
61+
if (e === B) {
62+
return 5;
63+
} else if (e[0] === C && !(e[1] !== 1 || e[2] !== 2)) {
64+
return 6;
65+
} else {
66+
return 7;
6867
}
69-
7068
}
7169
}
7270

jscomp/test/ext_filename_test.js

+13-13
Original file line numberDiff line numberDiff line change
@@ -119,20 +119,20 @@ function relative_path(file_or_dir_1, file_or_dir_2) {
119119
while(true) {
120120
var dir2 = _dir2;
121121
var dir1 = _dir1;
122-
var exit = 0;
123-
if (dir1 && dir2 && dir1[0] === dir2[0]) {
124-
_dir2 = dir2[1];
125-
_dir1 = dir1[1];
126-
continue ;
127-
} else {
128-
exit = 1;
129-
}
130-
if (exit === 1) {
131-
return Pervasives.$at(List.map((function (param) {
132-
return node_parent;
133-
}), dir2), dir1);
122+
if (dir1) {
123+
if (dir2) {
124+
if (dir1[0] === dir2[0]) {
125+
_dir2 = dir2[1];
126+
_dir1 = dir1[1];
127+
continue ;
128+
}
129+
130+
}
131+
134132
}
135-
133+
return Pervasives.$at(List.map((function (param) {
134+
return node_parent;
135+
}), dir2), dir1);
136136
};
137137
};
138138
var ys = go(dir1, dir2);

0 commit comments

Comments
 (0)