@@ -42,15 +42,15 @@ type error =
42
42
compilation_unit : CU .t ;
43
43
filename : Misc .filepath ;
44
44
}
45
- | Missing_argument of { param : Global_module.Name .t }
45
+ | Missing_argument of { param : Global_module.Parameter_name .t }
46
46
| No_such_parameter of {
47
47
base_unit : CU .t ;
48
- available_params : Global_module.Name .t list ;
49
- param : Global_module.Name .t ;
48
+ available_params : Global_module.Parameter_name .t list ;
49
+ param : Global_module.Parameter_name .t ;
50
50
arg : Global_module.Name .t ;
51
51
}
52
52
| Repeated_parameter of {
53
- param : Global_module.Name .t ;
53
+ param : Global_module.Parameter_name .t ;
54
54
arg1 : CU .t ;
55
55
arg2 : CU .t ;
56
56
}
@@ -85,11 +85,11 @@ let instantiate
85
85
let arg_pairs : CU.argument list =
86
86
List. map
87
87
(fun (param , (value , _ )) : CU. argument ->
88
- { param = CU. of_global_name param; value })
88
+ { param = CU.Name. of_parameter_name param; value })
89
89
arg_infos
90
90
in
91
- let arg_map : (CU.t * int) Global_module.Name .Map.t =
92
- match Global_module.Name .Map. of_list_checked arg_infos with
91
+ let arg_map : (CU.t * int) Global_module.Parameter_name .Map.t =
92
+ match Global_module.Parameter_name .Map. of_list_checked arg_infos with
93
93
| Ok map -> map
94
94
| Error (Duplicate { key; value1 = (arg1 , _ ); value2 = (arg2 , _ ) } ) ->
95
95
error (Repeated_parameter { param = key; arg1; arg2 })
@@ -138,7 +138,7 @@ let instantiate
138
138
let arg_subst : Global_module.subst =
139
139
global.visible_args
140
140
|> List. map (fun ({ param; value } : Global_module.argument ) -> param, value)
141
- |> Global_module.Name .Map. of_list
141
+ |> Global_module.Parameter_name .Map. of_list
142
142
in
143
143
let runtime_params, main_module_block_size =
144
144
match base_unit_info.ui_format with
@@ -154,18 +154,17 @@ let instantiate
154
154
|> List. map (fun runtime_param : Translmod. runtime_arg ->
155
155
match (runtime_param : Lambda.runtime_param ) with
156
156
| Rp_argument_block global ->
157
- let global_name = Global_module. to_name global in
158
157
begin
159
158
match
160
- Global_module.Name.Map. find_opt global_name arg_map
159
+ Global_module. find_in_parameter_map global arg_map
161
160
with
162
161
| Some (ra_unit , ra_field_idx ) ->
163
162
Argument_block { ra_unit; ra_field_idx }
164
163
| None ->
165
164
(* This should have been caught by
166
165
[Env.global_of_instance_compilation_unit] earlier *)
167
166
Misc. fatal_errorf " Can't find value for %a"
168
- Global_module.Name. print global_name
167
+ Global_module. print global
169
168
end
170
169
| Rp_main_module_block global ->
171
170
(* Substitute away any references to parameters in [global] *)
@@ -192,7 +191,7 @@ module Style = Misc.Style
192
191
let pp_parameters ppf params =
193
192
fprintf ppf " @[<hov>%a@]"
194
193
(pp_print_list ~pp_sep: pp_print_space
195
- (Style. as_inline_code Global_module.Name . print))
194
+ (Style. as_inline_code Global_module.Parameter_name . print))
196
195
params
197
196
198
197
let report_error ppf = function
@@ -231,18 +230,19 @@ let report_error ppf = function
231
230
(Style. as_inline_code Location. print_filename) filename
232
231
| Missing_argument { param } ->
233
232
fprintf ppf " No argument given for parameter %a"
234
- (Style. as_inline_code Global_module.Name . print) param
233
+ (Style. as_inline_code Global_module.Parameter_name . print) param
235
234
| No_such_parameter { base_unit; available_params; param; arg } ->
236
235
fprintf ppf
237
236
" @[<hov>Module %a@ is an argument for parameter %a,@ \
238
237
which is not a parameter of %a.@]@.\
239
238
@[<hov>@{<hint>Hint@}: @[<hov>%a@ was compiled with %a.@]@]@.\
240
239
@[<hov>@{<hint>Hint@}: @[<hov>Parameters of %a:@ %a@]@]"
241
240
(Style. as_inline_code Global_module.Name. print) arg
242
- (Style. as_inline_code Global_module.Name . print) param
241
+ (Style. as_inline_code Global_module.Parameter_name . print) param
243
242
(Style. as_inline_code CU. print) base_unit
244
243
(Style. as_inline_code Global_module.Name. print) arg
245
- (Style. as_clflag " -as-argument-for" Global_module.Name. print) param
244
+ (Style. as_clflag " -as-argument-for" Global_module.Parameter_name. print)
245
+ param
246
246
(Style. as_inline_code CU. print) base_unit
247
247
pp_parameters available_params
248
248
| Repeated_parameter { param; arg1; arg2 } ->
@@ -254,10 +254,11 @@ let report_error ppf = function
254
254
with %a.@]@]"
255
255
(Style. as_inline_code CU. print) arg1
256
256
(Style. as_inline_code CU. print) arg2
257
- (Style. as_inline_code Global_module.Name . print) param
257
+ (Style. as_inline_code Global_module.Parameter_name . print) param
258
258
(Style. as_inline_code CU. print) arg1
259
259
(Style. as_inline_code CU. print) arg2
260
- (Style. as_clflag " -as-argument-for" Global_module.Name. print) param
260
+ (Style. as_clflag " -as-argument-for" Global_module.Parameter_name. print)
261
+ param
261
262
let () =
262
263
Location. register_error_of_exn
263
264
(function
0 commit comments