@@ -154,7 +154,7 @@ type action =
154
154
| Drop
155
155
| Unit
156
156
| Build_info of Build_info .t
157
- | Source_map of Source_map .t
157
+ | Source_map of Source_map.Standard . t
158
158
159
159
let prefix_kind line =
160
160
match String. is_prefix ~prefix: sourceMappingURL line with
@@ -170,14 +170,19 @@ let prefix_kind line =
170
170
| true -> `Json_base64 (String. length sourceMappingURL_base64)
171
171
| false -> `Url (String. length sourceMappingURL))
172
172
173
+ let rule_out_index_map = function
174
+ | `Standard sm -> sm
175
+ | `Index _ -> failwith " unexpected index map at this stage"
176
+
173
177
let action ~resolve_sourcemap_url ~drop_source_map file line =
174
178
match prefix_kind line, drop_source_map with
175
179
| `Other , (true | false ) -> Keep
176
180
| `Unit , (true | false ) -> Unit
177
181
| `Build_info bi , _ -> Build_info bi
178
182
| (`Json_base64 _ | `Url _ ), true -> Drop
179
183
| `Json_base64 offset , false ->
180
- Source_map (Source_map. of_string (Base64. decode_exn ~off: offset line))
184
+ Source_map
185
+ (rule_out_index_map (Source_map. of_string (Base64. decode_exn ~off: offset line)))
181
186
| `Url _ , false when not resolve_sourcemap_url -> Drop
182
187
| `Url offset , false ->
183
188
let url = String. sub line ~pos: offset ~len: (String. length line - offset) in
@@ -186,7 +191,7 @@ let action ~resolve_sourcemap_url ~drop_source_map file line =
186
191
let l = in_channel_length ic in
187
192
let content = really_input_string ic l in
188
193
close_in ic;
189
- Source_map (Source_map. of_string content)
194
+ Source_map (rule_out_index_map ( Source_map. of_string content) )
190
195
191
196
module Units : sig
192
197
val read : Line_reader .t -> Unit_info .t -> Unit_info .t
@@ -444,18 +449,19 @@ let link ~output ~linkall ~mklib ~toplevel ~files ~resolve_sourcemap_url ~source
444
449
List. rev_map ! sm ~f: (fun (sm , reloc ) ->
445
450
let tbl = Hashtbl. create 17 in
446
451
List. iter reloc ~f: (fun (a , b ) -> Hashtbl. add tbl a b);
447
- Source_map. filter_map sm ~f: (Hashtbl. find_opt tbl))
452
+ Source_map.Standard. filter_map sm ~f: (Hashtbl. find_opt tbl))
448
453
in
449
- (match Source_map. merge (init_sm :: sm) with
454
+ (match Source_map.Standard. merge (init_sm :: sm) with
450
455
| None -> ()
451
456
| Some sm -> (
452
457
(* preserve some info from [init_sm] *)
453
458
let sm =
454
- { sm with
455
- version = init_sm.version
456
- ; file = init_sm.file
457
- ; sourceroot = init_sm.sourceroot
458
- }
459
+ `Standard
460
+ { sm with
461
+ version = init_sm.version
462
+ ; file = init_sm.file
463
+ ; sourceroot = init_sm.sourceroot
464
+ }
459
465
in
460
466
match file with
461
467
| None ->
0 commit comments