@@ -61,7 +61,27 @@ let make_common_shadows
61
61
}]
62
62
63
63
64
-
64
+ type suffixes = {
65
+ impl : string ;
66
+ intf : string ;
67
+ impl_ast : string ;
68
+ intf_ast : string ;
69
+ }
70
+
71
+ let re_suffixes = {
72
+ impl = Literals. suffix_re;
73
+ intf = Literals. suffix_rei;
74
+ impl_ast = Literals. suffix_reast;
75
+ intf_ast = Literals. suffix_reiast;
76
+
77
+ }
78
+
79
+ let ml_suffixes = {
80
+ impl = Literals. suffix_ml;
81
+ intf = Literals. suffix_mli;
82
+ impl_ast = Literals. suffix_mlast;
83
+ intf_ast = Literals. suffix_mliast
84
+ }
65
85
let emit_module_build
66
86
(rules : Bsb_ninja_rule.builtin )
67
87
(package_specs : Bsb_package_specs.t )
@@ -73,18 +93,15 @@ let emit_module_build
73
93
(module_info : Bsb_db.module_info )
74
94
=
75
95
let has_intf_file = module_info.info = Impl_intf in
76
- let is_re = module_info.syntax_kind = Reason in
96
+ let config, ast_rule =
97
+ match module_info.syntax_kind with
98
+ | Reason -> re_suffixes, rules.build_ast_from_re
99
+ | Ml -> ml_suffixes, rules.build_ast in
77
100
let filename_sans_extension = module_info.name_sans_extension in
78
- let input_impl =
79
- Bsb_config. proj_rel
80
- (filename_sans_extension ^ if is_re then Literals. suffix_re else Literals. suffix_ml ) in
81
- let input_intf =
82
- Bsb_config. proj_rel
83
- (filename_sans_extension ^ if is_re then Literals. suffix_rei else Literals. suffix_mli) in
84
- let output_mlast =
85
- filename_sans_extension ^ if is_re then Literals. suffix_reast else Literals. suffix_mlast in
86
- let output_mliast =
87
- filename_sans_extension ^ if is_re then Literals. suffix_reiast else Literals. suffix_mliast in
101
+ let input_impl = Bsb_config. proj_rel (filename_sans_extension ^ config.impl ) in
102
+ let input_intf = Bsb_config. proj_rel (filename_sans_extension ^ config.intf) in
103
+ let output_mlast = filename_sans_extension ^ config.impl_ast in
104
+ let output_mliast = filename_sans_extension ^ config.intf_ast in
88
105
let output_d = filename_sans_extension ^ Literals. suffix_d in
89
106
let output_filename_sans_extension =
90
107
Ext_namespace_encode. make ?ns:namespace filename_sans_extension
@@ -97,11 +114,7 @@ let emit_module_build
97
114
make_common_shadows package_specs
98
115
(Filename. dirname output_cmi)
99
116
in
100
- let ast_rule =
101
- if is_re then
102
- rules.build_ast_from_re
103
- else
104
- rules.build_ast in
117
+
105
118
Bsb_ninja_targets. output_build oc
106
119
~outputs: [output_mlast]
107
120
~inputs: [input_impl]
0 commit comments