Skip to content

Commit

Permalink
(- meta) Update lib/. Plz explain why this is checked into source-con…
Browse files Browse the repository at this point in the history
…trol ... =/
  • Loading branch information
ELLIOTTCABLE committed Apr 13, 2020
1 parent 9f4ab20 commit 4b65444
Show file tree
Hide file tree
Showing 11 changed files with 3,477 additions and 3,440 deletions.
2,912 changes: 1,481 additions & 1,431 deletions lib/4.06.1/bsb.ml

Large diffs are not rendered by default.

26 changes: 18 additions & 8 deletions lib/4.06.1/bsb_helper.ml
Expand Up @@ -2977,7 +2977,9 @@ val suffix_rei : string

val suffix_d : string
val suffix_js : string
val suffix_mjs : string
val suffix_bs_js : string
val suffix_bs_mjs : string
(* val suffix_re_js : string *)
val suffix_gen_js : string
val suffix_gen_tsx: string
Expand Down Expand Up @@ -3116,7 +3118,9 @@ let suffix_reiast = ".reiast"
let suffix_mliast_simple = ".mliast_simple"
let suffix_d = ".d"
let suffix_js = ".js"
let suffix_mjs = ".mjs"
let suffix_bs_js = ".bs.js"
let suffix_bs_mjs = ".bs.mjs"
(* let suffix_re_js = ".re.js" *)
let suffix_gen_js = ".gen.js"
let suffix_gen_tsx = ".gen.tsx"
Expand Down Expand Up @@ -3681,7 +3685,10 @@ val make : ?ns:string -> string -> string

val try_split_module_name : string -> (string * string) option

val change_ext_ns_suffix : string -> string -> string
val replace_namespace_with_extension : name:string -> ext:string -> string
(** [replace_namespace_with_extension ~name ~ext] removes the part of [name]
after [ns_sep_char], if any; and appends [ext].
*)

type file_kind = Upper_js | Upper_bs | Little_js | Little_bs

Expand Down Expand Up @@ -3751,7 +3758,7 @@ let rec rindex_rec s i =
#1933 when removing ns suffix, don't pass the bound of basename
FIXME: micro-optimizaiton *)
let change_ext_ns_suffix name ext =
let replace_namespace_with_extension ~name ~ext =
let i = rindex_rec name (String.length name - 1) in
if i < 0 then name ^ ext else String.sub name 0 i ^ ext

Expand All @@ -3768,13 +3775,16 @@ type file_kind = Upper_js | Upper_bs | Little_js | Little_bs
let js_name_of_modulename s little =
match little with
| Little_js ->
change_ext_ns_suffix (Ext_string.uncapitalize_ascii s) Literals.suffix_js
replace_namespace_with_extension
~name:(Ext_string.uncapitalize_ascii s)
~ext:Literals.suffix_js
| Little_bs ->
change_ext_ns_suffix
(Ext_string.uncapitalize_ascii s)
Literals.suffix_bs_js
| Upper_js -> change_ext_ns_suffix s Literals.suffix_js
| Upper_bs -> change_ext_ns_suffix s Literals.suffix_bs_js
replace_namespace_with_extension
~name:(Ext_string.uncapitalize_ascii s)
~ext:Literals.suffix_bs_js
| Upper_js -> replace_namespace_with_extension ~name:s ~ext:Literals.suffix_js
| Upper_bs ->
replace_namespace_with_extension ~name:s ~ext:Literals.suffix_bs_js


(** https://docs.npmjs.com/files/package.json
Expand Down
155 changes: 68 additions & 87 deletions lib/4.06.1/bsdep.ml
Expand Up @@ -36328,7 +36328,7 @@ end
module Bs_warnings : sig
#1 "bs_warnings.mli"
(* Copyright (C) 2015-2016 Bloomberg Finance L.P.
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
Expand All @@ -36346,29 +36346,25 @@ module Bs_warnings : sig
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)


type t =
| Unsafe_poly_variant_type
type t = Unsafe_poly_variant_type

val prerr_bs_ffi_warning : Location.t -> t -> unit

val warn_missing_primitive : Location.t -> string -> unit

val warn_missing_primitive : Location.t -> string -> unit

val warn_literal_overflow : Location.t -> unit
val warn_literal_overflow : Location.t -> unit

val error_unescaped_delimiter :
Location.t -> string -> unit
val error_unescaped_delimiter : Location.t -> string -> unit

end = struct
#1 "bs_warnings.ml"
(* Copyright (C) 2015-2016 Bloomberg Finance L.P.
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
Expand All @@ -36386,117 +36382,98 @@ end = struct
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)



type t =
| Unsafe_poly_variant_type
(* for users write code like this:
{[ external f : [`a of int ] -> string = ""]}
Here users forget about `[@bs.string]` or `[@bs.int]`
*)
(** for users write code like this:

{[ external f : [ `a of int ] -> string = "" ]}

Here users forget about `[@bs.string]` or `[@bs.int]` *)

let to_string t =
match t with
| Unsafe_poly_variant_type
->
"Here a OCaml polymorphic variant type passed into JS, probably you forgot annotations like `[@bs.int]` or `[@bs.string]` "
| Unsafe_poly_variant_type ->
"Here a OCaml polymorphic variant type passed into JS, probably you \
forgot annotations like `[@bs.int]` or `[@bs.string]` "


let warning_formatter = Format.err_formatter

let print_string_warning (loc : Location.t) x =
if loc.loc_ghost then
Format.fprintf warning_formatter "File %s@." !Location.input_name
else
Location.print warning_formatter loc ;
Format.fprintf warning_formatter "@{<error>Warning@}: %s@." x
let print_string_warning (loc : Location.t) x =
if loc.loc_ghost then
Format.fprintf warning_formatter "File %s@." !Location.input_name
else Location.print warning_formatter loc;
Format.fprintf warning_formatter "@{<error>Warning@}: %s@." x

let prerr_bs_ffi_warning loc x =
Location.prerr_warning loc (Warnings.Bs_ffi_warning (to_string x))

let unimplemented_primitive = "Unimplemented primitive used:"
type error =
| Uninterpreted_delimiters of string
| Unimplemented_primitive of string
exception Error of Location.t * error
let prerr_bs_ffi_warning loc x =
Location.prerr_warning loc (Warnings.Bs_ffi_warning (to_string x))

let pp_error fmt x =
match x with
| Unimplemented_primitive str ->
Format.pp_print_string fmt unimplemented_primitive;
Format.pp_print_string fmt str

| Uninterpreted_delimiters str ->
Format.pp_print_string fmt "Uninterpreted delimiters" ;
Format.pp_print_string fmt str

let unimplemented_primitive = "Unimplemented primitive used:"
type error =
| Uninterpreted_delimiters of string
| Unimplemented_primitive of string
exception Error of Location.t * error

let pp_error fmt x =
match x with
| Unimplemented_primitive str ->
Format.pp_print_string fmt unimplemented_primitive;
Format.pp_print_string fmt str
| Uninterpreted_delimiters str ->
Format.pp_print_string fmt "Uninterpreted delimiters";
Format.pp_print_string fmt str

let () =
Location.register_error_of_exn (function
| Error (loc,err) ->
Some (Location.error_of_printer loc pp_error err)
| _ -> None
)

let () =
Location.register_error_of_exn (function
| Error (loc, err) -> Some (Location.error_of_printer loc pp_error err)
| _ -> None)


let warn_missing_primitive loc txt =
if (not !Js_config.no_warn_unimplemented_external) && not !Clflags.bs_quiet
then (
print_string_warning loc (unimplemented_primitive ^ txt ^ " \n");
Format.pp_print_flush warning_formatter () )

let warn_missing_primitive loc txt =
if not !Js_config.no_warn_unimplemented_external && not !Clflags.bs_quiet then
begin
print_string_warning loc ( unimplemented_primitive ^ txt ^ " \n" );
Format.pp_print_flush warning_formatter ()
end

let warn_literal_overflow loc =
if not !Clflags.bs_quiet then
begin
print_string_warning loc
let warn_literal_overflow loc =
if not !Clflags.bs_quiet then (
print_string_warning loc
"Integer literal exceeds the range of representable integers of type int";
Format.pp_print_flush warning_formatter ()
end
Format.pp_print_flush warning_formatter () )


let error_unescaped_delimiter loc txt =
raise (Error (loc, Uninterpreted_delimiters txt))

let error_unescaped_delimiter loc txt =
raise (Error(loc, Uninterpreted_delimiters txt))

(** Note the standard way of reporting error in compiler:

val Location.register_error_of_exn : (exn -> Location.error option) -> unit
val Location.error_of_printer : Location.t -> (Format.formatter -> error ->
unit) -> error -> Location.error

Define an error type

type error exception Error of Location.t * error

Provide a printer to error

(**
Note the standard way of reporting error in compiler:

val Location.register_error_of_exn : (exn -> Location.error option) -> unit
val Location.error_of_printer : Location.t ->
(Format.formatter -> error -> unit) -> error -> Location.error

Define an error type

type error
exception Error of Location.t * error

Provide a printer to error

{[
let () =
Location.register_error_of_exn
(function
| Error(loc,err) ->
Some (Location.error_of_printer loc pp_error err)
| _ -> None
)
]}
*)
{[
let () =
Location.register_error_of_exn (function
| Error (loc, err) ->
Some (Location.error_of_printer loc pp_error err)
| _ -> None)
]} *)

end
module Ext_util : sig
Expand Down Expand Up @@ -37200,7 +37177,9 @@ val suffix_rei : string

val suffix_d : string
val suffix_js : string
val suffix_mjs : string
val suffix_bs_js : string
val suffix_bs_mjs : string
(* val suffix_re_js : string *)
val suffix_gen_js : string
val suffix_gen_tsx: string
Expand Down Expand Up @@ -37339,7 +37318,9 @@ let suffix_reiast = ".reiast"
let suffix_mliast_simple = ".mliast_simple"
let suffix_d = ".d"
let suffix_js = ".js"
let suffix_mjs = ".mjs"
let suffix_bs_js = ".bs.js"
let suffix_bs_mjs = ".bs.mjs"
(* let suffix_re_js = ".re.js" *)
let suffix_gen_js = ".gen.js"
let suffix_gen_tsx = ".gen.tsx"
Expand Down

0 comments on commit 4b65444

Please sign in to comment.