Skip to content

Commit 52e4ac1

Browse files
committed
CR
1 parent 49ae88c commit 52e4ac1

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

compiler/lib/source_map.ml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,9 @@ module Mappings = struct
340340
0
341341
edits
342342
in
343+
(* Remove trailing ';' *)
344+
if Buffer.length buf > 0 then
345+
Buffer.truncate buf (Buffer.length buf - 1);
343346
Uninterpreted (Buffer.contents buf)
344347

345348
let num_gen_lines m =
@@ -411,6 +414,9 @@ module Mappings = struct
411414
0
412415
(List.init ~len:(num_gen_lines m2) ~f:(Fun.const Line_edits.Keep))
413416
in
417+
(* Remove trailing ';' *)
418+
if Buffer.length buf > 0 then
419+
Buffer.truncate buf (Buffer.length buf - 1);
414420
Uninterpreted (Buffer.contents buf)
415421

416422
let encode mapping =

compiler/tests-compiler/sourcemap.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ let%expect_test _ =
153153
print_mapping m;
154154
[%expect
155155
{|
156-
CASU;;GCUU;;;;;;;;;;;;;;;;;;;;GCff;
156+
CASU;;GCUU;;;;;;;;;;;;;;;;;;;;GCff
157157
sa:10:10 -> 1:1
158158
sb:20:20 -> 3:3
159159
sa2:5:5 -> 23:3 |}]

0 commit comments

Comments
 (0)