Skip to content

Commit 838aa0e

Browse files
committed
snapshot
1 parent aec8e39 commit 838aa0e

File tree

5 files changed

+207
-98
lines changed

5 files changed

+207
-98
lines changed

lib/4.06.1/unstable/js_compiler.ml

Lines changed: 99 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -411571,6 +411571,98 @@ let rewrite_implementation (ast : Parsetree.structure) : Parsetree.structure =
411571411571
result
411572411572
end
411573411573

411574+
end
411575+
module Ext_io : sig
411576+
#1 "ext_io.mli"
411577+
(* Copyright (C) 2015-2016 Bloomberg Finance L.P.
411578+
*
411579+
* This program is free software: you can redistribute it and/or modify
411580+
* it under the terms of the GNU Lesser General Public License as published by
411581+
* the Free Software Foundation, either version 3 of the License, or
411582+
* (at your option) any later version.
411583+
*
411584+
* In addition to the permissions granted to you by the LGPL, you may combine
411585+
* or link a "work that uses the Library" with a publicly distributed version
411586+
* of this file to produce a combined library or application, then distribute
411587+
* that combined work under the terms of your choosing, with no requirement
411588+
* to comply with the obligations normally placed on you by section 4 of the
411589+
* LGPL version 3 (or the corresponding section of a later version of the LGPL
411590+
* should you choose to use a later version).
411591+
*
411592+
* This program is distributed in the hope that it will be useful,
411593+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
411594+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
411595+
* GNU Lesser General Public License for more details.
411596+
*
411597+
* You should have received a copy of the GNU Lesser General Public License
411598+
* along with this program; if not, write to the Free Software
411599+
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
411600+
411601+
val load_file : string -> string
411602+
411603+
val rev_lines_of_file : string -> string list
411604+
411605+
val rev_lines_of_chann : in_channel -> string list
411606+
411607+
val write_file : string -> string -> unit
411608+
411609+
end = struct
411610+
#1 "ext_io.ml"
411611+
(* Copyright (C) 2015-2016 Bloomberg Finance L.P.
411612+
*
411613+
* This program is free software: you can redistribute it and/or modify
411614+
* it under the terms of the GNU Lesser General Public License as published by
411615+
* the Free Software Foundation, either version 3 of the License, or
411616+
* (at your option) any later version.
411617+
*
411618+
* In addition to the permissions granted to you by the LGPL, you may combine
411619+
* or link a "work that uses the Library" with a publicly distributed version
411620+
* of this file to produce a combined library or application, then distribute
411621+
* that combined work under the terms of your choosing, with no requirement
411622+
* to comply with the obligations normally placed on you by section 4 of the
411623+
* LGPL version 3 (or the corresponding section of a later version of the LGPL
411624+
* should you choose to use a later version).
411625+
*
411626+
* This program is distributed in the hope that it will be useful,
411627+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
411628+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
411629+
* GNU Lesser General Public License for more details.
411630+
*
411631+
* You should have received a copy of the GNU Lesser General Public License
411632+
* along with this program; if not, write to the Free Software
411633+
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
411634+
411635+
411636+
(** on 32 bit , there are 16M limitation *)
411637+
let load_file f =
411638+
Ext_pervasives.finally (open_in_bin f) ~clean:close_in begin fun ic ->
411639+
let n = in_channel_length ic in
411640+
let s = Bytes.create n in
411641+
really_input ic s 0 n;
411642+
Bytes.unsafe_to_string s
411643+
end
411644+
411645+
411646+
let rev_lines_of_chann chan =
411647+
let rec loop acc chan =
411648+
match input_line chan with
411649+
| line -> loop (line :: acc) chan
411650+
| exception End_of_file -> close_in chan ; acc in
411651+
loop [] chan
411652+
411653+
411654+
let rev_lines_of_file file =
411655+
Ext_pervasives.finally
411656+
~clean:close_in
411657+
(open_in_bin file) rev_lines_of_chann
411658+
411659+
411660+
let write_file f content =
411661+
Ext_pervasives.finally ~clean:close_out
411662+
(open_out_bin f) begin fun oc ->
411663+
output_string oc content
411664+
end
411665+
411574411666
end
411575411667
module Super_misc : sig
411576411668
#1 "super_misc.mli"
@@ -411786,40 +411878,18 @@ let fprintf = Format.fprintf
411786411878

411787411879

411788411880

411789-
let file_lines filePath =
411790-
let chan = open_in_bin filePath in
411791-
let lines = ref [] in
411792-
try
411793-
while true do
411794-
lines := (input_line chan) :: !lines
411795-
done;
411796-
(* leave this here to make things type. The loop will definitly raise *)
411797-
[||]
411798-
with
411799-
| End_of_file -> begin
411800-
close_in chan;
411801-
List.rev (!lines) |> Array.of_list
411802-
end
411881+
let file_lines filePath =
411882+
Ext_array.reverse_of_list
411883+
(Ext_io.rev_lines_of_file filePath)
411803411884

411804411885
let setup_colors () =
411805411886
Misc.Color.setup !Clflags.color
411806411887

411807-
let print_filename ppf file =
411808-
match file with
411809-
(* modified *)
411810-
| "_none_"
411811-
| "" -> Format.fprintf ppf "(No file name)"
411812-
| real_file -> Format.fprintf ppf "%s" (Location.show_filename real_file)
411888+
let print_filename = Location.print_filename
411813411889

411814411890
let print_loc ~normalizedRange ppf (loc : Location.t) =
411815411891
setup_colors ();
411816-
let (file, _, _) = Location.get_pos_info loc.loc_start in
411817-
if file = "//toplevel//" then begin
411818-
if Location.highlight_locations ppf [loc] then () else
411819-
fprintf ppf "Characters %i-%i"
411820-
loc.loc_start.pos_cnum loc.loc_end.pos_cnum
411821-
end else
411822-
let dim_loc ppf = function
411892+
let dim_loc ppf = function
411823411893
| None -> ()
411824411894
| Some ((start_line, start_line_start_char), (end_line, end_line_end_char)) ->
411825411895
if start_line = end_line then
@@ -411829,14 +411899,11 @@ let print_loc ~normalizedRange ppf (loc : Location.t) =
411829411899
fprintf ppf " @{<dim>%i:%i-%i@}" start_line start_line_start_char end_line_end_char
411830411900
else
411831411901
fprintf ppf " @{<dim>%i:%i-%i:%i@}" start_line start_line_start_char end_line end_line_end_char
411832-
in
411833-
fprintf ppf "@{<filename>%a@}%a" print_filename file dim_loc normalizedRange
411902+
in
411903+
fprintf ppf "@{<filename>%a@}%a" print_filename loc.loc_start.pos_fname dim_loc normalizedRange
411834411904
;;
411835411905

411836411906
let print ~message_kind intro ppf (loc : Location.t) =
411837-
if loc.loc_start.pos_fname = "//toplevel//"
411838-
&& Location.highlight_locations ppf [loc] then ()
411839-
else
411840411907
begin match message_kind with
411841411908
| `warning -> fprintf ppf "@[@{<info>%s@}@]@," intro
411842411909
| `warning_as_error -> fprintf ppf "@[@{<error>%s@} (configured as error) @]@," intro

0 commit comments

Comments
 (0)