Skip to content

Commit 9497dfe

Browse files
committed
experimental work to make bundler happier
1 parent ec707f5 commit 9497dfe

File tree

100 files changed

+1039
-986
lines changed

Some content is hidden

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

100 files changed

+1039
-986
lines changed

jscomp/core/js_exp_make.ml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,11 @@ let runtime_call ?comment module_name fn_name args =
119119
~info:Js_call_info.builtin_runtime_call
120120
(runtime_var_dot module_name fn_name) args
121121

122+
let pure_runtime_call module_name fn_name args =
123+
call ~comment:Literals.pure
124+
~info:Js_call_info.builtin_runtime_call
125+
(runtime_var_dot module_name fn_name) args
126+
122127
let runtime_ref module_name fn_name =
123128
runtime_var_dot module_name fn_name
124129

jscomp/core/js_exp_make.mli

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,12 @@ val runtime_call :
9595
t list -> (* args *)
9696
t
9797

98+
val pure_runtime_call :
99+
string -> (* module_name *)
100+
string -> (* fn_name *)
101+
t list -> (* args *)
102+
t
103+
98104
val runtime_ref :
99105
string ->
100106
string ->

jscomp/core/js_long.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ let of_const (v : Int64.t) =
5454
| -9223372036854775808L ->
5555
E.runtime_var_dot Js_runtime_modules.int64 "min_int"
5656
| _ ->
57-
E.runtime_call Js_runtime_modules.int64 "mk"
57+
E.pure_runtime_call Js_runtime_modules.int64 "mk"
5858
[
5959
E.int (Int64.to_int32 v );
6060
E.int (Int64.to_int32 (Int64.shift_right v 32))

jscomp/core/js_of_lam_exception.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ module E = Js_exp_make
4343
about the correctness of inlining more difficult
4444
*)
4545
let make exception_str : J.expression =
46-
E.runtime_call Js_runtime_modules.exceptions Literals.create [exception_str]
46+
E.pure_runtime_call Js_runtime_modules.exceptions Literals.create [exception_str]
4747

4848

4949

jscomp/ext/literals.ml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,3 +143,5 @@ let tl = "tl"
143143

144144
let lazy_done = "LAZY_DONE"
145145
let lazy_val = "VAL"
146+
147+
let pure = "@__PURE__"

jscomp/test/406_primitive_test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ eq("File \"406_primitive_test.ml\", line 29, characters 6-13", backend_type, /*
2727
});
2828

2929
function f(param) {
30-
var A = Caml_exceptions.create("A");
30+
var A = /* @__PURE__ */Caml_exceptions.create("A");
3131
try {
3232
for(var i = 0; i <= 200; ++i){
3333
if (i === 10) {

jscomp/test/array_test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ var Caml_exceptions = require("../../lib/js/caml_exceptions.js");
1111
var Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js");
1212

1313
function starts_with(xs, prefix, p) {
14-
var H = Caml_exceptions.create("H");
14+
var H = /* @__PURE__ */Caml_exceptions.create("H");
1515
var len1 = xs.length;
1616
var len2 = prefix.length;
1717
if (len2 > len1) {

jscomp/test/bs_min_max_test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ var f5_max = Caml_obj.caml_max;
4545

4646
b("File \"bs_min_max_test.ml\", line 28, characters 4-11", Caml_int64.eq(Caml_int64.min(Caml_int64.zero, Caml_int64.one), Caml_int64.zero));
4747

48-
b("File \"bs_min_max_test.ml\", line 29, characters 4-11", Caml_int64.eq(Caml_int64.max(Caml_int64.mk(22, 0), Caml_int64.one), Caml_int64.mk(22, 0)));
48+
b("File \"bs_min_max_test.ml\", line 29, characters 4-11", Caml_int64.eq(Caml_int64.max(/* @__PURE__ */Caml_int64.mk(22, 0), Caml_int64.one), /* @__PURE__ */Caml_int64.mk(22, 0)));
4949

50-
b("File \"bs_min_max_test.ml\", line 30, characters 4-11", Caml_int64.eq(Caml_int64.max(Caml_int64.mk(-3, -1), Caml_int64.mk(3, 0)), Caml_int64.mk(3, 0)));
50+
b("File \"bs_min_max_test.ml\", line 30, characters 4-11", Caml_int64.eq(Caml_int64.max(/* @__PURE__ */Caml_int64.mk(-3, -1), /* @__PURE__ */Caml_int64.mk(3, 0)), /* @__PURE__ */Caml_int64.mk(3, 0)));
5151

5252
eq("File \"bs_min_max_test.ml\", line 31, characters 5-12", Caml_obj.caml_min(undefined, 3), undefined);
5353

jscomp/test/caml_format_test.js

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2085,7 +2085,7 @@ var int64_suites_1 = {
20852085
_3: /* End_of_format */0
20862086
},
20872087
_1: "%Ld"
2088-
}), Caml_int64.mk(3, 0)),
2088+
}), /* @__PURE__ */Caml_int64.mk(3, 0)),
20892089
_1: "3"
20902090
};
20912091
})
@@ -2105,7 +2105,7 @@ var int64_suites_1 = {
21052105
_3: /* End_of_format */0
21062106
},
21072107
_1: "%Lx"
2108-
}), Caml_int64.mk(33, 0)),
2108+
}), /* @__PURE__ */Caml_int64.mk(33, 0)),
21092109
_1: "21"
21102110
};
21112111
})
@@ -2125,7 +2125,7 @@ var int64_suites_1 = {
21252125
_3: /* End_of_format */0
21262126
},
21272127
_1: "%Li"
2128-
}), Caml_int64.mk(33, 0)),
2128+
}), /* @__PURE__ */Caml_int64.mk(33, 0)),
21292129
_1: "33"
21302130
};
21312131
})
@@ -2145,7 +2145,7 @@ var int64_suites_1 = {
21452145
_3: /* End_of_format */0
21462146
},
21472147
_1: "%LX"
2148-
}), Caml_int64.mk(44, 0)),
2148+
}), /* @__PURE__ */Caml_int64.mk(44, 0)),
21492149
_1: "2C"
21502150
};
21512151
})
@@ -2165,7 +2165,7 @@ var int64_suites_1 = {
21652165
_3: /* End_of_format */0
21662166
},
21672167
_1: "%Lx"
2168-
}), Caml_int64.mk(44, 0)),
2168+
}), /* @__PURE__ */Caml_int64.mk(44, 0)),
21692169
_1: "2c"
21702170
};
21712171
})
@@ -2188,7 +2188,7 @@ var int64_suites_1 = {
21882188
_3: /* End_of_format */0
21892189
},
21902190
_1: "%*Lx"
2191-
}), 5, Caml_int64.mk(44, 0)),
2191+
}), 5, /* @__PURE__ */Caml_int64.mk(44, 0)),
21922192
_1: " 2c"
21932193
};
21942194
})
@@ -2199,7 +2199,7 @@ var int64_suites_1 = {
21992199
(function (param) {
22002200
return {
22012201
TAG: /* Eq */0,
2202-
_0: Caml_int64.to_string(Caml_int64.mk(3333, 0)),
2202+
_0: Caml_int64.to_string(/* @__PURE__ */Caml_int64.mk(3333, 0)),
22032203
_1: "3333"
22042204
};
22052205
})
@@ -2229,7 +2229,7 @@ var int64_suites_1 = {
22292229
}
22302230
},
22312231
_1: "%Ld%018Ld"
2232-
}), Caml_int64.mk(3, 0), Caml_int64.mk(3, 0)),
2232+
}), /* @__PURE__ */Caml_int64.mk(3, 0), /* @__PURE__ */Caml_int64.mk(3, 0)),
22332233
_1: "3000000000000000003"
22342234
};
22352235
})
@@ -2259,7 +2259,7 @@ var int64_suites_1 = {
22592259
}
22602260
},
22612261
_1: "%Ld%018Ld"
2262-
}), Caml_int64.mk(1548746752, 107288), Caml_int64.zero),
2262+
}), /* @__PURE__ */Caml_int64.mk(1548746752, 107288), Caml_int64.zero),
22632263
_1: "460800000000000000000000000000000"
22642264
};
22652265
})
@@ -2319,7 +2319,7 @@ var int64_suites_1 = {
23192319
_3: /* End_of_format */0
23202320
},
23212321
_1: "%Ld"
2322-
}), Caml_int64.mk(-11111, -1)),
2322+
}), /* @__PURE__ */Caml_int64.mk(-11111, -1)),
23232323
_1: "-11111"
23242324
};
23252325
})
@@ -2439,7 +2439,7 @@ var int64_suites_1 = {
24392439
_3: /* End_of_format */0
24402440
},
24412441
_1: "%Lu"
2442-
}), Caml_int64.mk(-100, -1)),
2442+
}), /* @__PURE__ */Caml_int64.mk(-100, -1)),
24432443
_1: "18446744073709551516"
24442444
};
24452445
})
@@ -2479,7 +2479,7 @@ var int64_suites_1 = {
24792479
_3: /* End_of_format */0
24802480
},
24812481
_1: "%Lu"
2482-
}), Caml_int64.mk(-10000, -1)),
2482+
}), /* @__PURE__ */Caml_int64.mk(-10000, -1)),
24832483
_1: "18446744073709541616"
24842484
};
24852485
})
@@ -2543,7 +2543,7 @@ var int64_suites_1 = {
25432543
_3: /* End_of_format */0
25442544
},
25452545
_1: "%12Lx"
2546-
}), Caml_int64.mk(3, 0)),
2546+
}), /* @__PURE__ */Caml_int64.mk(3, 0)),
25472547
_1: " 3"
25482548
};
25492549
})
@@ -2563,7 +2563,7 @@ var int64_suites_1 = {
25632563
_3: /* End_of_format */0
25642564
},
25652565
_1: "%LX"
2566-
}), Caml_int64.mk(1163551168, 1859194407)),
2566+
}), /* @__PURE__ */Caml_int64.mk(1163551168, 1859194407)),
25672567
_1: "6ED10E27455A61C0"
25682568
};
25692569
})
@@ -2587,7 +2587,7 @@ var int64_suites_1 = {
25872587
}
25882588
},
25892589
_1: "%Ld\n"
2590-
}), Caml_int64.mk(32, 0)),
2590+
}), /* @__PURE__ */Caml_int64.mk(32, 0)),
25912591
_1: "32\n"
25922592
};
25932593
})
@@ -2612,7 +2612,7 @@ var int64_suites_1 = {
26122612
}
26132613
},
26142614
_1: "%Ld\n"
2615-
}), Caml_int64.mk(32, 0)), $$Buffer.contents(buf)),
2615+
}), /* @__PURE__ */Caml_int64.mk(32, 0)), $$Buffer.contents(buf)),
26162616
_1: "32\n"
26172617
};
26182618
})
@@ -2657,31 +2657,31 @@ var of_string_data = [
26572657
"0"
26582658
],
26592659
[
2660-
Caml_int64.mk(3, 0),
2660+
/* @__PURE__ */Caml_int64.mk(3, 0),
26612661
"3"
26622662
],
26632663
[
2664-
Caml_int64.mk(33, 0),
2664+
/* @__PURE__ */Caml_int64.mk(33, 0),
26652665
"33"
26662666
],
26672667
[
2668-
Caml_int64.mk(333, 0),
2668+
/* @__PURE__ */Caml_int64.mk(333, 0),
26692669
"33_3"
26702670
],
26712671
[
2672-
Caml_int64.mk(33333, 0),
2672+
/* @__PURE__ */Caml_int64.mk(33333, 0),
26732673
"33_33_3"
26742674
],
26752675
[
2676-
Caml_int64.mk(-1674115755, 77),
2676+
/* @__PURE__ */Caml_int64.mk(-1674115755, 77),
26772677
"333333333333"
26782678
],
26792679
[
26802680
Caml_int64.neg_one,
26812681
"0xffff_ffff_ffff_ffff"
26822682
],
26832683
[
2684-
Caml_int64.mk(113, 0),
2684+
/* @__PURE__ */Caml_int64.mk(113, 0),
26852685
"0b01110001"
26862686
],
26872687
[
@@ -2756,9 +2756,9 @@ var float_suites = {
27562756
tl: /* [] */0
27572757
};
27582758

2759-
var hh = Caml_int64.mk(-858993460, 214748364);
2759+
var hh = /* @__PURE__ */Caml_int64.mk(-858993460, 214748364);
27602760

2761-
var hhh = Caml_int64.mk(0, 268435456);
2761+
var hhh = /* @__PURE__ */Caml_int64.mk(0, 268435456);
27622762

27632763
exports.of_string = of_string;
27642764
exports.from_float_of_string = from_float_of_string;

jscomp/test/div_by_zero_test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ add([
9696
return {
9797
TAG: /* ThrowAny */7,
9898
_0: (function (param) {
99-
Caml_int64.div(Caml_int64.mk(3, 0), Caml_int64.zero);
99+
Caml_int64.div(/* @__PURE__ */Caml_int64.mk(3, 0), Caml_int64.zero);
100100

101101
})
102102
};
@@ -109,7 +109,7 @@ add([
109109
return {
110110
TAG: /* ThrowAny */7,
111111
_0: (function (param) {
112-
Caml_int64.mod_(Caml_int64.mk(3, 0), Caml_int64.zero);
112+
Caml_int64.mod_(/* @__PURE__ */Caml_int64.mk(3, 0), Caml_int64.zero);
113113

114114
})
115115
};

0 commit comments

Comments
 (0)