Skip to content

Commit 49ae88c

Browse files
committed
CR
1 parent ee43168 commit 49ae88c

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

compiler/lib/source_map.ml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -894,6 +894,17 @@ module Index = struct
894894
| `Assoc fields -> (
895895
let string name json = Option.map ~f:string_of_stringlit (stringlit name json) in
896896
let file = string "file" fields in
897+
(match List.assoc "version" fields with
898+
| `Intlit v ->
899+
if not (Int.equal (int_of_string v) 3)
900+
then
901+
invalid_arg
902+
(Printf.sprintf
903+
"Source_map.Index.of_json: sourcemap version %s not supported"
904+
v)
905+
| _ -> invalid_arg "Source_map.Index.of_json: non-integer `version` value"
906+
| exception Not_found ->
907+
warn "warning: Missing `version` field in sourcemap");
897908
match List.assoc "sections" fields with
898909
| `List sections ->
899910
let sections = List.map ~f:section_of_json sections in

0 commit comments

Comments
 (0)