Skip to content

Commit 6917fcc

Browse files
committed
Remove suffix_ml* and dependencies.
1 parent 064f90f commit 6917fcc

File tree

10 files changed

+18
-57
lines changed

10 files changed

+18
-57
lines changed

jscomp/bsb/bsb_db_util.ml

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,12 @@ let sanity_check (map : t) =
3939
(* invariant check:
4040
ml and mli should have the same case, same path
4141
*)
42-
let check (x : module_info) name_sans_extension case syntax_kind
42+
let check (x : module_info) name_sans_extension case
4343
(module_info : Bsb_db.info) =
4444
let x_ml_info = x.info in
4545
if
4646
x.name_sans_extension <> name_sans_extension
4747
|| x.case <> case
48-
|| x.syntax_kind <> syntax_kind
4948
|| x_ml_info = module_info || x_ml_info = Impl_intf
5049
then
5150
Bsb_exception.invalid_spec
@@ -75,19 +74,14 @@ let add_basename ~(dir : string) (map : t) ?error_on_invalid_suffix basename : t
7574
if is_editor_temporary_files basename then map
7675
else
7776
let info = ref Bsb_db.Impl in
78-
let syntax_kind = ref Bsb_db.Ml in
7977
let invalid_suffix = ref false in
8078
let file_suffix = Ext_filename.get_extension_maybe basename in
8179
(match () with
82-
| _ when file_suffix = Literals.suffix_ml -> ()
83-
| _ when file_suffix = Literals.suffix_res -> syntax_kind := Res
84-
| _ when file_suffix = Literals.suffix_mli -> info := Intf
80+
| _ when file_suffix = Literals.suffix_res -> ()
8581
| _ when file_suffix = Literals.suffix_resi ->
86-
info := Intf;
87-
syntax_kind := Res
82+
info := Intf
8883
| _ -> invalid_suffix := true);
8984
let info = !info in
90-
let syntax_kind = !syntax_kind in
9185
let invalid_suffix = !invalid_suffix in
9286
if invalid_suffix then
9387
match error_on_invalid_suffix with
@@ -105,5 +99,5 @@ let add_basename ~(dir : string) (map : t) ?error_on_invalid_suffix basename : t
10599
let dir = Filename.dirname name_sans_extension in
106100
Map_string.adjust map module_name (fun opt_module_info ->
107101
match opt_module_info with
108-
| None -> { dir; name_sans_extension; info; syntax_kind; case }
109-
| Some x -> check x name_sans_extension case syntax_kind info)
102+
| None -> { dir; name_sans_extension; info; case }
103+
| Some x -> check x name_sans_extension case info)

jscomp/bsb/bsb_ninja_file_groups.ml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,20 +40,13 @@ let handle_generators oc (group : Bsb_file_groups.file_group) custom_rules =
4040

4141
type suffixes = { impl : string; intf : string }
4242

43-
let ml_suffixes = { impl = Literals.suffix_ml; intf = Literals.suffix_mli }
44-
4543
let res_suffixes = { impl = Literals.suffix_res; intf = Literals.suffix_resi }
4644

4745
let emit_module_build (rules : Bsb_ninja_rule.builtin)
4846
(package_specs : Bsb_package_specs.t) (is_dev : bool) oc namespace
4947
(module_info : Bsb_db.module_info) : unit =
5048
let has_intf_file = module_info.info = Impl_intf in
51-
let config, ast_rule =
52-
match module_info.syntax_kind with
53-
| Ml -> (ml_suffixes, rules.build_ast)
54-
| Res -> (res_suffixes, rules.build_ast_from_re)
55-
(* FIXME: better names *)
56-
in
49+
let config, ast_rule = (res_suffixes, rules.build_ast_from_re) in
5750
let filename_sans_extension = module_info.name_sans_extension in
5851
let input_impl =
5952
Bsb_config.proj_rel (filename_sans_extension ^ config.impl)

jscomp/bsb/bsb_ninja_gen.ml

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ let output_installation_file cwd_lib_bs namespace files_to_install =
9494
let essentials = Ext_buffer.create 1_000 in
9595
files_to_install
9696
|> Queue.iter
97-
(fun ({ name_sans_extension; syntax_kind; info } : Bsb_db.module_info) ->
97+
(fun ({ name_sans_extension; info } : Bsb_db.module_info) ->
9898
let base = Filename.basename name_sans_extension in
9999
let dest = Ext_namespace_encode.make ?ns:namespace base in
100100
let ns_origin =
@@ -110,22 +110,14 @@ let output_installation_file cwd_lib_bs namespace files_to_install =
110110
Ext_buffer.add_string essentials dest;
111111
Ext_buffer.add_string_char essentials Literals.suffix_cmj ' ';
112112

113-
let suffix =
114-
match syntax_kind with
115-
| Ml -> Literals.suffix_ml
116-
| Res -> Literals.suffix_res
117-
in
118-
oo suffix ~dest:base ~src:(sb // name_sans_extension);
113+
let suffix_impl = Literals.suffix_res in
114+
oo suffix_impl ~dest:base ~src:(sb // name_sans_extension);
119115
match info with
120116
| Intf -> assert false
121117
| Impl -> ()
122118
| Impl_intf ->
123-
let suffix_b =
124-
match syntax_kind with
125-
| Ml -> Literals.suffix_mli
126-
| Res -> Literals.suffix_resi
127-
in
128-
oo suffix_b ~dest:base ~src:(sb // name_sans_extension);
119+
let suffix_intf = Literals.suffix_resi in
120+
oo suffix_intf ~dest:base ~src:(sb // name_sans_extension);
129121
oo Literals.suffix_cmti ~dest ~src);
130122
(match namespace with
131123
| None -> ()

jscomp/bsb/bsb_ninja_rule.ml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ let define ~command ?dyndep ?restat rule_name : t =
6767
type command = string
6868

6969
type builtin = {
70-
build_ast : t; (** TODO: Implement it on top of pp_flags *)
7170
build_ast_from_re : t;
7271
(* build_ast_from_rei : t ; *)
7372
(* platform dependent, on Win32,
@@ -179,7 +178,6 @@ let make_custom_rules ~(gentype_config : Bsb_config_types.gentype_config)
179178
Ext_buffer.add_string buf " -absname -bs-ast -o $out $i";
180179
Ext_buffer.contents buf
181180
in
182-
let build_ast = define ~command:mk_ast "ast" in
183181
let build_ast_from_re = define ~command:mk_ast "astj" in
184182

185183
let copy_resources =
@@ -223,7 +221,6 @@ let make_custom_rules ~(gentype_config : Bsb_config_types.gentype_config)
223221
~restat:() "build_package"
224222
in
225223
{
226-
build_ast;
227224
build_ast_from_re;
228225
(* platform dependent, on Win32,
229226
invoking cmd.exe

jscomp/bsb/bsb_ninja_rule.mli

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ val get_name : t -> out_channel -> string
3232
(***********************************************************)
3333

3434
type builtin = {
35-
build_ast : t;
3635
build_ast_from_re : t;
3736
(* platform dependent, on Win32,
3837
invoking cmd.exe

jscomp/bsb_exe/rescript_main.ml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -197,14 +197,12 @@ let info_subcommand ~start argv =
197197
| Some { file_groups = { files } } ->
198198
Ext_list.iter files (fun { sources } ->
199199
Map_string.iter sources
200-
(fun _ { info; syntax_kind; name_sans_extension } ->
200+
(fun _ { info; name_sans_extension } ->
201201
let extensions =
202-
match (syntax_kind, info) with
203-
| _, Intf -> assert false
204-
| Ml, Impl -> [ ".ml" ]
205-
| Ml, Impl_intf -> [ ".ml"; ".mli" ]
206-
| Res, Impl -> [ ".res" ]
207-
| Res, Impl_intf -> [ ".res"; ".resi" ]
202+
match info with
203+
| Intf -> assert false
204+
| Impl -> [ ".res" ]
205+
| Impl_intf -> [ ".res"; ".resi" ]
208206
in
209207
Ext_list.iter extensions (fun x ->
210208
print_endline (name_sans_extension ^ x)))))

jscomp/ext/bsb_db.ml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,10 @@ type info =
3131
| Impl
3232
| Impl_intf
3333

34-
type syntax_kind = Ml | Res
3534

3635
type module_info = {
3736
mutable info : info;
3837
dir : string;
39-
syntax_kind : syntax_kind;
4038
case : bool;
4139
name_sans_extension : string;
4240
}

jscomp/ext/bsb_db.mli

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,10 @@ type info =
3737
| Impl
3838
| Impl_intf
3939

40-
type syntax_kind = Ml | Res
4140

4241
type module_info = {
4342
mutable info : info;
4443
dir : string;
45-
syntax_kind : syntax_kind;
46-
(* This is actually not stored in bsbuild meta info
47-
since creating .d file only emit .cmj/.cmi dependencies, so it does not
48-
need know which syntax it is written
49-
*)
5044
case : bool;
5145
name_sans_extension : string;
5246
}

jscomp/ext/literals.ml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,6 @@ let suffix_cmxa = ".cmxa"
9999

100100
let suffix_mll = ".mll"
101101

102-
let suffix_ml = ".ml"
103-
104-
let suffix_mli = ".mli"
105-
106102
let suffix_res = ".res"
107103

108104
let suffix_resi = ".resi"

jscomp/ounit_tests/ounit_bsb_pkg_tests.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ let s_test1 s a =
3434

3535
let group0 = Map_string.of_list [
3636
"Liba",
37-
{Bsb_db.info = Impl_intf; dir= "a";syntax_kind=Ml;case = false;
37+
{Bsb_db.info = Impl_intf; dir= "a";case = false;
3838
name_sans_extension = "liba"}
3939
]
4040
let group1 = Map_string.of_list [
4141
"Ciba",
42-
{Bsb_db.info = Impl_intf; dir= "b";syntax_kind=Ml;case = false;
42+
{Bsb_db.info = Impl_intf; dir= "b";case = false;
4343
name_sans_extension = "liba"}
4444
]
4545

0 commit comments

Comments
 (0)