@@ -366101,6 +366101,70 @@ let write_file f content =
366101366101 end
366102366102
366103366103end
366104+ module Ext_namespace_encode : sig
366105+ #1 "ext_namespace_encode.mli"
366106+ (* Copyright (C) 2020- Authors of BuckleScript
366107+ *
366108+ * This program is free software: you can redistribute it and/or modify
366109+ * it under the terms of the GNU Lesser General Public License as published by
366110+ * the Free Software Foundation, either version 3 of the License, or
366111+ * (at your option) any later version.
366112+ *
366113+ * In addition to the permissions granted to you by the LGPL, you may combine
366114+ * or link a "work that uses the Library" with a publicly distributed version
366115+ * of this file to produce a combined library or application, then distribute
366116+ * that combined work under the terms of your choosing, with no requirement
366117+ * to comply with the obligations normally placed on you by section 4 of the
366118+ * LGPL version 3 (or the corresponding section of a later version of the LGPL
366119+ * should you choose to use a later version).
366120+ *
366121+ * This program is distributed in the hope that it will be useful,
366122+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
366123+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
366124+ * GNU Lesser General Public License for more details.
366125+ *
366126+ * You should have received a copy of the GNU Lesser General Public License
366127+ * along with this program; if not, write to the Free Software
366128+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
366129+
366130+ (** [make ~ns:"Ns" "a" ]
366131+ A typical example would return "a-Ns"
366132+ Note the namespace comes from the output of [namespace_of_package_name]
366133+ *)
366134+ val make :
366135+ ?ns:string -> string -> string
366136+
366137+ end = struct
366138+ #1 "ext_namespace_encode.ml"
366139+ (* Copyright (C) 2020- Authors of BuckleScript
366140+ *
366141+ * This program is free software: you can redistribute it and/or modify
366142+ * it under the terms of the GNU Lesser General Public License as published by
366143+ * the Free Software Foundation, either version 3 of the License, or
366144+ * (at your option) any later version.
366145+ *
366146+ * In addition to the permissions granted to you by the LGPL, you may combine
366147+ * or link a "work that uses the Library" with a publicly distributed version
366148+ * of this file to produce a combined library or application, then distribute
366149+ * that combined work under the terms of your choosing, with no requirement
366150+ * to comply with the obligations normally placed on you by section 4 of the
366151+ * LGPL version 3 (or the corresponding section of a later version of the LGPL
366152+ * should you choose to use a later version).
366153+ *
366154+ * This program is distributed in the hope that it will be useful,
366155+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
366156+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
366157+ * GNU Lesser General Public License for more details.
366158+ *
366159+ * You should have received a copy of the GNU Lesser General Public License
366160+ * along with this program; if not, write to the Free Software
366161+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
366162+
366163+ let make ?ns cunit =
366164+ match ns with
366165+ | None -> cunit
366166+ | Some ns -> cunit ^ Literals.ns_sep ^ ns
366167+ end
366104366168module Depend : sig
366105366169#1 "depend.mli"
366106366170(**************************************************************************)
@@ -367330,70 +367394,6 @@ end = struct
367330367394
367331367395 let hex_length = 32
367332367396end
367333- module Ext_namespace_encode : sig
367334- #1 "ext_namespace_encode.mli"
367335- (* Copyright (C) 2020- Authors of BuckleScript
367336- *
367337- * This program is free software: you can redistribute it and/or modify
367338- * it under the terms of the GNU Lesser General Public License as published by
367339- * the Free Software Foundation, either version 3 of the License, or
367340- * (at your option) any later version.
367341- *
367342- * In addition to the permissions granted to you by the LGPL, you may combine
367343- * or link a "work that uses the Library" with a publicly distributed version
367344- * of this file to produce a combined library or application, then distribute
367345- * that combined work under the terms of your choosing, with no requirement
367346- * to comply with the obligations normally placed on you by section 4 of the
367347- * LGPL version 3 (or the corresponding section of a later version of the LGPL
367348- * should you choose to use a later version).
367349- *
367350- * This program is distributed in the hope that it will be useful,
367351- * but WITHOUT ANY WARRANTY; without even the implied warranty of
367352- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
367353- * GNU Lesser General Public License for more details.
367354- *
367355- * You should have received a copy of the GNU Lesser General Public License
367356- * along with this program; if not, write to the Free Software
367357- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
367358-
367359- (** [make ~ns:"Ns" "a" ]
367360- A typical example would return "a-Ns"
367361- Note the namespace comes from the output of [namespace_of_package_name]
367362- *)
367363- val make :
367364- ?ns:string -> string -> string
367365-
367366- end = struct
367367- #1 "ext_namespace_encode.ml"
367368- (* Copyright (C) 2020- Authors of BuckleScript
367369- *
367370- * This program is free software: you can redistribute it and/or modify
367371- * it under the terms of the GNU Lesser General Public License as published by
367372- * the Free Software Foundation, either version 3 of the License, or
367373- * (at your option) any later version.
367374- *
367375- * In addition to the permissions granted to you by the LGPL, you may combine
367376- * or link a "work that uses the Library" with a publicly distributed version
367377- * of this file to produce a combined library or application, then distribute
367378- * that combined work under the terms of your choosing, with no requirement
367379- * to comply with the obligations normally placed on you by section 4 of the
367380- * LGPL version 3 (or the corresponding section of a later version of the LGPL
367381- * should you choose to use a later version).
367382- *
367383- * This program is distributed in the hope that it will be useful,
367384- * but WITHOUT ANY WARRANTY; without even the implied warranty of
367385- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
367386- * GNU Lesser General Public License for more details.
367387- *
367388- * You should have received a copy of the GNU Lesser General Public License
367389- * along with this program; if not, write to the Free Software
367390- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
367391-
367392- let make ?ns cunit =
367393- match ns with
367394- | None -> cunit
367395- | Some ns -> cunit ^ Literals.ns_sep ^ ns
367396- end
367397367397module Ext_modulename : sig
367398367398#1 "ext_modulename.mli"
367399367399(* Copyright (C) 2017 Authors of BuckleScript
@@ -436137,21 +436137,15 @@ end = struct
436137436137(***********************************************************************)
436138436138
436139436139let output_prefix name =
436140- let oname =
436141- match !Clflags.output_name with
436142- | None -> name
436143- | Some n -> (Clflags.output_name := None; n) in
436144- Filename.remove_extension oname
436140+ match !Clflags.output_name with
436141+ | None ->
436142+ Ext_namespace_encode.make
436143+ (Filename.remove_extension name)
436144+ ?ns:!Clflags.dont_record_crc_unit
436145+ | Some oname ->
436146+ Filename.remove_extension oname
436145436147
436146436148
436147- let process_interface_file ppf name =
436148- Js_implementation.interface ppf name
436149- ~parser:Pparse_driver.parse_interface
436150- (output_prefix name)
436151- let process_implementation_file ppf name =
436152- Js_implementation.implementation ppf name
436153- ~parser:Pparse_driver.parse_implementation
436154- (output_prefix name)
436155436149
436156436150
436157436151let setup_error_printer (syntax_kind : [ `ml | `reason | `rescript ])=
@@ -436193,20 +436187,19 @@ let handle_reason (type a) (kind : a Ml_binary.kind) sourcefile ppf opref =
436193436187
436194436188
436195436189
436196-
436197-
436198-
436199-
436200- let process_file ppf sourcefile =
436190+ let process_file sourcefile
436191+ ?(kind ) ppf =
436201436192 (* This is a better default then "", it will be changed later
436202436193 The {!Location.input_name} relies on that we write the binary ast
436203436194 properly
436204436195 *)
436205- Location.set_input_name sourcefile;
436206- let ext = Ext_filename.get_extension_maybe sourcefile in
436207- let input = Ext_file_extensions.classify_input ext in
436196+ Location.set_input_name sourcefile;
436208436197 let opref = output_prefix sourcefile in
436209- match input with
436198+ let kind =
436199+ match kind with
436200+ | None -> Ext_file_extensions.classify_input (Ext_filename.get_extension_maybe sourcefile)
436201+ | Some kind -> kind in
436202+ match kind with
436210436203 | Re -> handle_reason Ml sourcefile ppf opref
436211436204 | Rei ->
436212436205 handle_reason Mli sourcefile ppf opref
@@ -436265,7 +436258,7 @@ let anonymous ~(rev_args : string list) =
436265436258 begin
436266436259 match rev_args with
436267436260 | [filename] ->
436268- process_file ppf filename
436261+ process_file filename ppf
436269436262 | [] -> ()
436270436263 | _ ->
436271436264 Bsc_args.bad_arg "can not handle multiple files"
@@ -436274,10 +436267,10 @@ let anonymous ~(rev_args : string list) =
436274436267(** used by -impl -intf *)
436275436268let impl filename =
436276436269 Js_config.js_stdout := false;
436277- process_implementation_file ppf filename ;;
436270+ process_file filename ~kind:Ml ppf ;;
436278436271let intf filename =
436279436272 Js_config.js_stdout := false ;
436280- process_interface_file ppf filename;;
436273+ process_file filename ~kind:Mli ppf ;;
436281436274
436282436275
436283436276let format_file input =
0 commit comments