Skip to content

Commit 003d1b6

Browse files
committed
Fix warnings when building playground compiler
1 parent 0aff3a6 commit 003d1b6

File tree

2 files changed

+25
-21
lines changed

2 files changed

+25
-21
lines changed

jscomp/core/js_name_of_module_id.ml

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,22 @@
2525
let (=) (x : int) (y:float) = assert false
2626
*)
2727

28+
#ifdef BROWSER
29+
30+
let string_of_module_id_in_browser (x : Lam_module_ident.t) =
31+
match x.kind with
32+
| External {name} -> name
33+
| Runtime | Ml ->
34+
"./stdlib/" ^ Ext_string.uncapitalize_ascii x.id.name ^ ".js"
2835

36+
let string_of_module_id
37+
(id : Lam_module_ident.t)
38+
~output_dir:(_:string)
39+
(_module_system : Js_packages_info.module_system)
40+
= string_of_module_id_in_browser id
41+
42+
#else
43+
2944
let (//) = Filename.concat
3045

3146

@@ -87,8 +102,6 @@ let get_runtime_module_path
87102
path //dep_path // js_file
88103
)
89104

90-
91-
92105
(* [output_dir] is decided by the command line argument *)
93106
let string_of_module_id
94107
(dep_module_id : Lam_module_ident.t)
@@ -187,18 +200,4 @@ let string_of_module_id
187200
| None ->
188201
Bs_exception.error (Js_not_found js_file))
189202

190-
191-
192-
(* Override it in browser *)
193-
#ifdef BROWSER
194-
let string_of_module_id_in_browser (x : Lam_module_ident.t) =
195-
match x.kind with
196-
| External {name} -> name
197-
| Runtime | Ml ->
198-
"./stdlib/" ^ Ext_string.uncapitalize_ascii x.id.name ^ ".js"
199-
let string_of_module_id
200-
(id : Lam_module_ident.t)
201-
~output_dir:(_:string)
202-
(_module_system : Js_packages_info.module_system)
203-
= string_of_module_id_in_browser id
204-
#endif
203+
#endif

jscomp/ml/cmt_format.ml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@
1313
(* *)
1414
(**************************************************************************)
1515

16-
open Cmi_format
16+
#ifdef BROWSER
17+
[@@@warning "-32"]
18+
#endif
19+
1720
open Typedtree
1821

1922
(* Note that in Typerex, there is an awful hack to save a cmt file
@@ -164,10 +167,12 @@ let record_value_dependency vd1 vd2 =
164167
if vd1.Types.val_loc <> vd2.Types.val_loc then
165168
value_deps := (vd1, vd2) :: !value_deps
166169

167-
let save_cmt filename modname binary_annots sourcefile initial_env cmi =
168170
#ifdef BROWSER
169-
()
170-
#else
171+
let save_cmt _filename _modname _binary_annots _sourcefile _initial_env _cmi = ()
172+
#else
173+
open Cmi_format
174+
175+
let save_cmt filename modname binary_annots sourcefile initial_env cmi =
171176
if !Clflags.binary_annotations then begin
172177
(if !Config.bs_only then Misc.output_to_bin_file_directly else
173178
Misc.output_to_file_via_temporary

0 commit comments

Comments
 (0)