Skip to content

Commit 2d87e7e

Browse files
committed
reuse ext_io
1 parent f193a8f commit 2d87e7e

File tree

1 file changed

+3
-14
lines changed

1 file changed

+3
-14
lines changed

jscomp/super_errors/super_location.ml

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,9 @@ let fprintf = Format.fprintf
44

55

66

7-
let file_lines filePath =
8-
let chan = open_in_bin filePath in
9-
let lines = ref [] in
10-
try
11-
while true do
12-
lines := (input_line chan) :: !lines
13-
done;
14-
(* leave this here to make things type. The loop will definitly raise *)
15-
[||]
16-
with
17-
| End_of_file -> begin
18-
close_in chan;
19-
List.rev (!lines) |> Array.of_list
20-
end
7+
let file_lines filePath =
8+
Ext_array.reverse_of_list
9+
(Ext_io.rev_lines_of_file filePath)
2110

2211
let setup_colors () =
2312
Misc.Color.setup !Clflags.color

0 commit comments

Comments
 (0)