Skip to content

Commit d1434c9

Browse files
committed
Js_runtime_modules -> Primitive_modules
1 parent e263f97 commit d1434c9

12 files changed

+52
-52
lines changed

Diff for: jscomp/core/js_block_runtime.ml

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@
2222
* along with this program; if not, write to the Free Software
2323
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
2424

25-
let option_id = Ident.create_persistent Js_runtime_modules.option
25+
let option_id = Ident.create_persistent Primitive_modules.option
2626

27-
let curry_id = Ident.create_persistent Js_runtime_modules.curry
27+
let curry_id = Ident.create_persistent Primitive_modules.curry
2828

2929
let check_additional_id (x : J.expression) : Ident.t option =
3030
match x.expression_desc with

Diff for: jscomp/core/js_dump.ml

+2-2
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ module L = Js_dump_lit
7474

7575
module Curry_gen = struct
7676
let pp_curry_dot f =
77-
P.string f Js_runtime_modules.curry;
77+
P.string f Primitive_modules.curry;
7878
P.string f L.dot
7979

8080
let pp_optimize_curry (f : P.t) (len : int) =
@@ -720,7 +720,7 @@ and expression_desc cxt ~(level : int) f x : cxt =
720720
| Optional_block (e, identity) ->
721721
expression ~level cxt f
722722
(if identity then e
723-
else E.runtime_call Js_runtime_modules.option "some" [ e ])
723+
else E.runtime_call Primitive_modules.option "some" [ e ])
724724
| Caml_block (el, _, _, Blk_module fields) ->
725725
expression_desc cxt ~level f
726726
(Object (None,

Diff for: jscomp/core/js_exp_make.ml

+5-5
Original file line numberDiff line numberDiff line change
@@ -1119,15 +1119,15 @@ let int32_div ~checked ?comment (e1 : t) (e2 : t) : t =
11191119
| Number (Int { i = i0 }) -> int (Int32.div i0 i1)
11201120
| _ -> to_int32 (float_div ?comment e1 e2))
11211121
| _, _ ->
1122-
if checked then runtime_call Js_runtime_modules.int "div" [ e1; e2 ]
1122+
if checked then runtime_call Primitive_modules.int "div" [ e1; e2 ]
11231123
else to_int32 (float_div ?comment e1 e2)
11241124

11251125
let int32_mod ~checked ?comment e1 (e2 : t) : J.expression =
11261126
match e2.expression_desc with
11271127
| Number (Int { i }) when i <> 0l ->
11281128
{ comment; expression_desc = Bin (Mod, e1, e2) }
11291129
| _ ->
1130-
if checked then runtime_call Js_runtime_modules.int "mod_" [ e1; e2 ]
1130+
if checked then runtime_call Primitive_modules.int "mod_" [ e1; e2 ]
11311131
else { comment; expression_desc = Bin (Mod, e1, e2) }
11321132

11331133
let float_mul ?comment e1 e2 = bin ?comment Mul e1 e2
@@ -1231,13 +1231,13 @@ let bigint_comp (cmp : Lam_compat.comparison) ?comment (e0: t) (e1: t) =
12311231

12321232
let bigint_div ~checked ?comment (e0: t) (e1: t) =
12331233
if checked then
1234-
runtime_call Js_runtime_modules.bigint "div" [e0; e1]
1234+
runtime_call Primitive_modules.bigint "div" [e0; e1]
12351235
else
12361236
bigint_op ?comment Div e0 e1
12371237

12381238
let bigint_mod ~checked ?comment (e0: t) (e1: t) =
12391239
if checked then
1240-
runtime_call Js_runtime_modules.bigint "mod_" [e0; e1]
1240+
runtime_call Primitive_modules.bigint "mod_" [e0; e1]
12411241
else
12421242
bigint_op ?comment Mod e0 e1
12431243

@@ -1306,7 +1306,7 @@ let neq_null_undefined_boolean ?comment (a : t) (b : t) =
13061306
| _ -> { expression_desc = Bin (NotEqEq, a, b); comment }
13071307

13081308
let make_exception (s : string) =
1309-
pure_runtime_call Js_runtime_modules.exceptions Literals.create [ str s ]
1309+
pure_runtime_call Primitive_modules.exceptions Literals.create [ str s ]
13101310

13111311
let rec variadic_args (args : t list) =
13121312
match args with

Diff for: jscomp/core/js_of_lam_option.ml

+3-3
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ let is_not_none (e : J.expression) : J.expression =
6666
let val_from_option (arg : J.expression) =
6767
match arg.expression_desc with
6868
| Optional_block (x, _) -> x
69-
| _ -> E.runtime_call Js_runtime_modules.option "valFromOption" [ arg ]
69+
| _ -> E.runtime_call Primitive_modules.option "valFromOption" [ arg ]
7070

7171
let get_default_undefined_from_optional (arg : J.expression) : J.expression =
7272
let desc = arg.expression_desc in
@@ -78,7 +78,7 @@ let get_default_undefined_from_optional (arg : J.expression) : J.expression =
7878
if Js_analyzer.is_okay_to_duplicate arg then
7979
(* FIXME: no need do such inlining*)
8080
E.econd (is_not_none arg) (val_from_option arg) E.undefined
81-
else E.runtime_call Js_runtime_modules.option "toUndefined" [ arg ]
81+
else E.runtime_call Primitive_modules.option "toUndefined" [ arg ]
8282

8383
let option_unwrap (arg : J.expression) : J.expression =
8484
let desc = arg.expression_desc in
@@ -87,7 +87,7 @@ let option_unwrap (arg : J.expression) : J.expression =
8787
match desc with
8888
| Optional_block (x, _) -> E.poly_var_value_access x
8989
(* invariant: option encoding *)
90-
| _ -> E.runtime_call Js_runtime_modules.option "unwrapPolyVar" [ arg ]
90+
| _ -> E.runtime_call Primitive_modules.option "unwrapPolyVar" [ arg ]
9191

9292
let destruct_optional ~for_sure_none ~for_sure_some ~not_sure
9393
(arg : J.expression) =

Diff for: jscomp/core/lam_compile.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ and compile_recursive_let ~all_bindings (cxt : Lam_compile_context.t)
446446
(Ext_list.append b
447447
[
448448
S.exp
449-
(E.runtime_call Js_runtime_modules.object_
449+
(E.runtime_call Primitive_modules.object_
450450
"update_dummy" [ E.var id; v ]);
451451
]),
452452
[ S.define_variable ~kind:Variable id (E.dummy_obj tag_info) ] )

Diff for: jscomp/core/lam_compile_primitive.ml

+33-33
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ let translate output_prefix loc (cxt : Lam_compile_context.t)
7878
| Pis_not_none -> Js_of_lam_option.is_not_none (Ext_list.singleton_exn args)
7979
| Pcreate_extension s -> E.make_exception s
8080
| Pwrap_exn ->
81-
E.runtime_call Js_runtime_modules.exceptions
81+
E.runtime_call Primitive_modules.exceptions
8282
"internalToException" args
8383
| Praw_js_code { code; code_info } -> E.raw_js_code code_info code
8484
(* FIXME: save one allocation
@@ -96,22 +96,22 @@ let translate output_prefix loc (cxt : Lam_compile_context.t)
9696
| [ e ] -> (
9797
match e.expression_desc with
9898
| Var _ | Undefined _ | Null -> Js_of_lam_option.null_to_opt e
99-
| _ -> E.runtime_call Js_runtime_modules.option "fromNull" args)
99+
| _ -> E.runtime_call Primitive_modules.option "fromNull" args)
100100
| _ -> assert false)
101101
| Pundefined_to_opt -> (
102102
match args with
103103
| [ e ] -> (
104104
match e.expression_desc with
105105
| Var _ | Undefined _ | Null -> Js_of_lam_option.undef_to_opt e
106106
| _ ->
107-
E.runtime_call Js_runtime_modules.option "fromUndefined" args)
107+
E.runtime_call Primitive_modules.option "fromUndefined" args)
108108
| _ -> assert false)
109109
| Pnull_undefined_to_opt -> (
110110
match args with
111111
| [ e ] -> (
112112
match e.expression_desc with
113113
| Var _ | Undefined _ | Null -> Js_of_lam_option.null_undef_to_opt e
114-
| _ -> E.runtime_call Js_runtime_modules.option "fromNullable" args
114+
| _ -> E.runtime_call Primitive_modules.option "fromNullable" args
115115
)
116116
| _ -> assert false)
117117
(* Compile %import: The module argument for dynamic import is represented as a path,
@@ -150,8 +150,8 @@ let translate output_prefix loc (cxt : Lam_compile_context.t)
150150
assert false (* already handled by {!Lam_compile} *)
151151
| Pstringadd -> (
152152
match args with [ a; b ] -> E.string_append a b | _ -> assert false)
153-
| Pinit_mod -> E.runtime_call Js_runtime_modules.module_ "init_mod" args
154-
| Pupdate_mod -> E.runtime_call Js_runtime_modules.module_ "update_mod" args
153+
| Pinit_mod -> E.runtime_call Primitive_modules.module_ "init_mod" args
154+
| Pupdate_mod -> E.runtime_call Primitive_modules.module_ "update_mod" args
155155
| Psome -> (
156156
let arg = Ext_list.singleton_exn args in
157157
match arg.expression_desc with
@@ -301,7 +301,7 @@ let translate output_prefix loc (cxt : Lam_compile_context.t)
301301
| Pstringlength -> E.string_length (Ext_list.singleton_exn args)
302302
| Pstringrefs | Pstringrefu -> (
303303
match args with
304-
| [ e; e1 ] -> E.runtime_call Js_runtime_modules.string "getChar" args
304+
| [ e; e1 ] -> E.runtime_call Primitive_modules.string "getChar" args
305305
| _ -> assert false)
306306
(* polymorphic operations *)
307307
| Pobjcomp cmp -> (
@@ -316,23 +316,23 @@ let translate output_prefix loc (cxt : Lam_compile_context.t)
316316
E.neq_null_undefined_boolean e1 e2
317317
| [ e1; e2 ] ->
318318
Location.prerr_warning loc Warnings.Bs_polymorphic_comparison;
319-
E.runtime_call Js_runtime_modules.object_
319+
E.runtime_call Primitive_modules.object_
320320
(Lam_compile_util.runtime_of_comp cmp) args
321321
| _ -> assert false)
322322
| Pobjorder -> (
323323
Location.prerr_warning loc Warnings.Bs_polymorphic_comparison;
324324
match args with
325-
| [ a; b ] -> E.runtime_call Js_runtime_modules.object_ "compare" args
325+
| [ a; b ] -> E.runtime_call Primitive_modules.object_ "compare" args
326326
| _ -> assert false)
327327
| Pobjmin -> (
328328
Location.prerr_warning loc Warnings.Bs_polymorphic_comparison;
329329
match args with
330-
| [ a; b ] -> E.runtime_call Js_runtime_modules.object_ "min" args
330+
| [ a; b ] -> E.runtime_call Primitive_modules.object_ "min" args
331331
| _ -> assert false)
332332
| Pobjmax -> (
333333
Location.prerr_warning loc Warnings.Bs_polymorphic_comparison;
334334
match args with
335-
| [ a; b ] -> E.runtime_call Js_runtime_modules.object_ "max" args
335+
| [ a; b ] -> E.runtime_call Primitive_modules.object_ "max" args
336336
| _ -> assert false)
337337
| Pobjtag -> (
338338
(* Note that in ocaml, [int] has tag [1000] and [string] has tag [252]
@@ -344,7 +344,7 @@ let translate output_prefix loc (cxt : Lam_compile_context.t)
344344
| [ { expression_desc = Bool a }; { expression_desc = Bool b } ] ->
345345
let c = compare (a : bool) b in
346346
E.int (if c = 0 then 0l else if c > 0 then 1l else -1l)
347-
| [ a; b ] -> E.runtime_call Js_runtime_modules.bool "compare" args
347+
| [ a; b ] -> E.runtime_call Primitive_modules.bool "compare" args
348348
| _ -> assert false)
349349
| Pboolmin -> (
350350
match args with
@@ -353,88 +353,88 @@ let translate output_prefix loc (cxt : Lam_compile_context.t)
353353
Js_analyzer.is_okay_to_duplicate a
354354
&& Js_analyzer.is_okay_to_duplicate b
355355
then E.econd (E.js_comp Clt a b) a b
356-
else E.runtime_call Js_runtime_modules.bool "min" args
357-
| [ a; b ] -> E.runtime_call Js_runtime_modules.bool "min" args
356+
else E.runtime_call Primitive_modules.bool "min" args
357+
| [ a; b ] -> E.runtime_call Primitive_modules.bool "min" args
358358
| _ -> assert false)
359359
| Pboolmax -> (
360360
match args with
361361
| [ { expression_desc = Bool _ } as a; { expression_desc = Bool _ } as b ]
362362
when Js_analyzer.is_okay_to_duplicate a && Js_analyzer.is_okay_to_duplicate b ->
363363
E.econd (E.js_comp Cgt a b) a b
364-
| [ a; b ] -> E.runtime_call Js_runtime_modules.bool "max" args
364+
| [ a; b ] -> E.runtime_call Primitive_modules.bool "max" args
365365
| _ -> assert false)
366366
| Pintorder -> (
367367
match args with
368-
| [ a; b ] -> E.runtime_call Js_runtime_modules.int "compare" args
368+
| [ a; b ] -> E.runtime_call Primitive_modules.int "compare" args
369369
| _ -> assert false)
370370
| Pintmin -> (
371371
match args with
372372
| [ { expression_desc = Number (Int _) } as a; { expression_desc = Number (Int _) } as b ]
373373
when Js_analyzer.is_okay_to_duplicate a && Js_analyzer.is_okay_to_duplicate b ->
374374
E.econd (E.js_comp Clt a b) a b
375-
| [ a; b ] -> E.runtime_call Js_runtime_modules.int "min" args
375+
| [ a; b ] -> E.runtime_call Primitive_modules.int "min" args
376376
| _ -> assert false)
377377
| Pintmax -> (
378378
match args with
379379
| [ { expression_desc = Number (Int _) } as a; { expression_desc = Number (Int _) } as b ]
380380
when Js_analyzer.is_okay_to_duplicate a && Js_analyzer.is_okay_to_duplicate b ->
381381
E.econd (E.js_comp Cgt a b) a b
382-
| [ a; b ] -> E.runtime_call Js_runtime_modules.int "max" args
382+
| [ a; b ] -> E.runtime_call Primitive_modules.int "max" args
383383
| _ -> assert false)
384384
| Pfloatorder -> (
385385
match args with
386386
| [ a; b ] as args ->
387-
E.runtime_call Js_runtime_modules.float "compare" args
387+
E.runtime_call Primitive_modules.float "compare" args
388388
| _ -> assert false)
389389
| Pfloatmin -> (
390390
match args with
391391
| [ { expression_desc = Number (Float _) } as a; { expression_desc = Number (Float _) } as b ]
392392
when Js_analyzer.is_okay_to_duplicate a && Js_analyzer.is_okay_to_duplicate b ->
393393
E.econd (E.js_comp Clt a b) a b
394-
| [ a; b ] -> E.runtime_call Js_runtime_modules.float "min" args
394+
| [ a; b ] -> E.runtime_call Primitive_modules.float "min" args
395395
| _ -> assert false)
396396
| Pfloatmax -> (
397397
match args with
398398
| [ { expression_desc = Number (Float _) } as a; { expression_desc = Number (Float _) } as b ]
399399
when Js_analyzer.is_okay_to_duplicate a && Js_analyzer.is_okay_to_duplicate b ->
400400
E.econd (E.js_comp Cgt a b) a b
401-
| [ a; b ] -> E.runtime_call Js_runtime_modules.float "max" args
401+
| [ a; b ] -> E.runtime_call Primitive_modules.float "max" args
402402
| _ -> assert false)
403403
| Pbigintorder -> (
404404
match args with
405-
| [ a; b ] -> E.runtime_call Js_runtime_modules.bigint "compare" args
405+
| [ a; b ] -> E.runtime_call Primitive_modules.bigint "compare" args
406406
| _ -> assert false)
407407
| Pbigintmin -> (
408408
match args with
409409
| [ { expression_desc = Number (BigInt _) } as a; { expression_desc = Number (BigInt _) } as b ]
410410
when Js_analyzer.is_okay_to_duplicate a && Js_analyzer.is_okay_to_duplicate b ->
411411
E.econd (E.js_comp Clt a b) a b
412-
| [ a; b ] -> E.runtime_call Js_runtime_modules.bigint "min" args
412+
| [ a; b ] -> E.runtime_call Primitive_modules.bigint "min" args
413413
| _ -> assert false)
414414
| Pbigintmax -> (
415415
match args with
416416
| [ { expression_desc = Number (Float _) } as a; { expression_desc = Number (Float _) } as b ]
417417
when Js_analyzer.is_okay_to_duplicate a && Js_analyzer.is_okay_to_duplicate b ->
418418
E.econd (E.js_comp Cgt a b) a b
419-
| [ a; b ] -> E.runtime_call Js_runtime_modules.bigint "max" args
419+
| [ a; b ] -> E.runtime_call Primitive_modules.bigint "max" args
420420
| _ -> assert false)
421421
| Pstringorder -> (
422422
match args with
423-
| [ a; b ] -> E.runtime_call Js_runtime_modules.string "compare" args
423+
| [ a; b ] -> E.runtime_call Primitive_modules.string "compare" args
424424
| _ -> assert false)
425425
| Pstringmin -> (
426426
match args with
427427
| [ { expression_desc = Str _ } as a; { expression_desc = Str _ } as b ]
428428
when Js_analyzer.is_okay_to_duplicate a && Js_analyzer.is_okay_to_duplicate b ->
429429
E.econd (E.js_comp Clt a b) a b
430-
| [a; b] -> E.runtime_call Js_runtime_modules.string "min" args
430+
| [a; b] -> E.runtime_call Primitive_modules.string "min" args
431431
| _ -> assert false)
432432
| Pstringmax -> (
433433
match args with
434434
| [ { expression_desc = Str _ } as a; { expression_desc = Str _ } as b ]
435435
when Js_analyzer.is_okay_to_duplicate a && Js_analyzer.is_okay_to_duplicate b ->
436436
E.econd (E.js_comp Cgt a b) a b
437-
| [a; b] -> E.runtime_call Js_runtime_modules.string "max" args
437+
| [a; b] -> E.runtime_call Primitive_modules.string "max" args
438438
| _ -> assert false)
439439
(* only when Lapply -> expand = true*)
440440
| Praise -> assert false (* handled before here *)
@@ -452,8 +452,8 @@ let translate output_prefix loc (cxt : Lam_compile_context.t)
452452
match args with
453453
| [ e; e1 ] -> Js_of_lam_array.ref_array e e1 (* Todo: Constant Folding *)
454454
| _ -> assert false)
455-
| Parrayrefs -> E.runtime_call Js_runtime_modules.array "get" args
456-
| Parraysets -> E.runtime_call Js_runtime_modules.array "set" args
455+
| Parrayrefs -> E.runtime_call Primitive_modules.array "get" args
456+
| Parraysets -> E.runtime_call Primitive_modules.array "set" args
457457
| Pmakearray -> Js_of_lam_array.make_array Mutable args
458458
| Pmakelist ->
459459
Js_of_lam_block.make_block
@@ -497,19 +497,19 @@ let translate output_prefix loc (cxt : Lam_compile_context.t)
497497
| _ -> assert false)
498498
| Phash -> (
499499
match args with
500-
| [ e1; e2; e3; e4 ] -> E.runtime_call Js_runtime_modules.hash "hash" args
500+
| [ e1; e2; e3; e4 ] -> E.runtime_call Primitive_modules.hash "hash" args
501501
| _ -> assert false)
502502
| Phash_mixint -> (
503503
match args with
504-
| [ e1; e2 ] -> E.runtime_call Js_runtime_modules.hash "hash_mix_int" args
504+
| [ e1; e2 ] -> E.runtime_call Primitive_modules.hash "hash_mix_int" args
505505
| _ -> assert false)
506506
| Phash_mixstring -> (
507507
match args with
508-
| [ e1; e2 ] -> E.runtime_call Js_runtime_modules.hash "hash_mix_string" args
508+
| [ e1; e2 ] -> E.runtime_call Primitive_modules.hash "hash_mix_string" args
509509
| _ -> assert false)
510510
| Phash_finalmix -> (
511511
match args with
512-
| [ e1 ] -> E.runtime_call Js_runtime_modules.hash "hash_final_mix" args
512+
| [ e1 ] -> E.runtime_call Primitive_modules.hash "hash_final_mix" args
513513
| _ -> assert false)
514514
| Plazyforce
515515
(* FIXME: we don't inline lazy force or at least
File renamed without changes.

Diff for: jscomp/frontend/ast_derive_js_mapper.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ let app2 = Ast_compatible.app2
130130
let ( ->~ ) a b = Ast_compatible.arrow a b
131131

132132
let raise_when_not_found_ident =
133-
Longident.Ldot (Lident Js_runtime_modules.util, "raiseWhenNotFound")
133+
Longident.Ldot (Lident Primitive_modules.util, "raiseWhenNotFound")
134134

135135
let raise_when_not_found x =
136136
app1 (Exp.ident {loc = noloc; txt = raise_when_not_found_ident}) x

Diff for: jscomp/ml/ast_async.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ let add_promise_type ?(loc = Location.none) ~async
66
if async then
77
let unsafe_async =
88
Ast_helper.Exp.ident ~loc
9-
{txt = Ldot (Lident Js_runtime_modules.promise, "unsafe_async"); loc}
9+
{txt = Ldot (Lident Primitive_modules.promise, "unsafe_async"); loc}
1010
in
1111
Ast_helper.Exp.apply ~loc unsafe_async [(Nolabel, result)]
1212
else result

Diff for: jscomp/ml/ast_await.ml

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ let create_await_expression (e : Parsetree.expression) =
55
let loc = {e.pexp_loc with loc_ghost = true} in
66
let unsafe_await =
77
Ast_helper.Exp.ident ~loc
8-
{txt = Ldot (Lident Js_runtime_modules.promise, "unsafe_await"); loc}
8+
{txt = Ldot (Lident Primitive_modules.promise, "unsafe_await"); loc}
99
in
1010
Ast_helper.Exp.apply ~loc unsafe_await [(Nolabel, e)]
1111

@@ -24,7 +24,7 @@ let create_await_module_expression ~module_type_lid (e : Parsetree.module_expr)
2424
(Exp.apply ~loc:e.pmod_loc
2525
(Exp.ident ~loc:e.pmod_loc
2626
{
27-
txt = Longident.Ldot (Lident Js_runtime_modules.module_, "import");
27+
txt = Longident.Ldot (Lident Primitive_modules.module_, "import");
2828
loc = e.pmod_loc;
2929
})
3030
[

Diff for: jscomp/ml/matching.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1486,7 +1486,7 @@ let get_mod_field modname field =
14861486

14871487

14881488
let code_force =
1489-
get_mod_field Js_runtime_modules.lazy_ "force"
1489+
get_mod_field Primitive_modules.lazy_ "force"
14901490
;;
14911491

14921492
(* inline_lazy_force inlines the beginning of the code of Lazy.force. When

Diff for: jscomp/syntax/src/res_core.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3958,7 +3958,7 @@ and parse_dict_expr ~start_pos p =
39583958
Ast_helper.Exp.apply ~loc
39593959
(Ast_helper.Exp.ident ~loc
39603960
(Location.mkloc
3961-
(Longident.Ldot (Longident.Lident Js_runtime_modules.dict, "make"))
3961+
(Longident.Ldot (Longident.Lident Primitive_modules.dict, "make"))
39623962
loc))
39633963
[(Asttypes.Nolabel, Ast_helper.Exp.array ~loc key_value_pairs)]
39643964

0 commit comments

Comments
 (0)