Skip to content

Commit 2f22ec5

Browse files
vouillonOlivierNicole
authored andcommitted
Generate: explicit initialization
1 parent 23956cc commit 2f22ec5

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

compiler/bin-js_of_ocaml/check_runtime.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ let print_groups output l =
4343
output_string output (Printf.sprintf "%s\n" name)))
4444

4545
let f (runtime_files, bytecode, target_env) =
46+
Generate.init ();
4647
let runtime_files, builtin =
4748
List.partition_map runtime_files ~f:(fun name ->
4849
match Builtins.find name with

compiler/bin-js_of_ocaml/compile.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ let run
9191
let include_cmis = toplevel && not no_cmis in
9292
let custom_header = common.Jsoo_cmdline.Arg.custom_header in
9393
Jsoo_cmdline.Arg.eval common;
94+
Generate.init ();
9495
(match output_file with
9596
| `Stdout, _ -> ()
9697
| `Name name, _ when debug_mem () -> Debug.start_profiling name

compiler/lib/generate.ml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2056,5 +2056,3 @@ let init () =
20562056
Hashtbl.iter
20572057
(fun name (k, _) -> Primitive.register name k None None)
20582058
internal_primitives
2059-
2060-
let () = init ()

compiler/lib/primitive.ml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,17 +98,17 @@ let register p k kargs arity =
9898
(string_of_kind k));
9999
add_external p;
100100
(match arity with
101-
| Some a -> Hashtbl.add arities p a
101+
| Some a -> Hashtbl.replace arities p a
102102
| _ -> ());
103103
(match kargs with
104-
| Some k -> Hashtbl.add kind_args_tbl p k
104+
| Some k -> Hashtbl.replace kind_args_tbl p k
105105
| _ -> ());
106-
Hashtbl.add kinds p k
106+
Hashtbl.replace kinds p k
107107

108108
let alias nm nm' =
109109
add_external nm';
110110
add_external nm;
111-
Hashtbl.add aliases nm nm'
111+
Hashtbl.replace aliases nm nm'
112112

113113
let named_values = ref StringSet.empty
114114

0 commit comments

Comments
 (0)