Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions jscomp/bsb/bsb_ninja_rule.ml
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ let make_custom_rules
~(digest : string)
~(refmt : string option) (* set refmt path when needed *)
~(package_specs: Bsb_package_specs.t)
~namespace
~(namespace : string option)
~package_name
~bsc
~warnings
Expand Down Expand Up @@ -172,7 +172,7 @@ let make_custom_rules
Ext_buffer.add_string buf package_name;
Ext_buffer.add_string buf (Bsb_package_specs.package_flag_of_package_specs package_specs "$in_d")
end;
Ext_buffer.add_string buf " -o $out $i";
Ext_buffer.add_string buf " $i";
begin match postbuild with
| None -> ()
| Some cmd ->
Expand Down
43 changes: 18 additions & 25 deletions jscomp/main/js_main.ml
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,15 @@
(***********************************************************************)

let output_prefix name =
let oname =
match !Clflags.output_name with
| None -> name
| Some n -> (Clflags.output_name := None; n) in
Filename.remove_extension oname
match !Clflags.output_name with
| None ->
Ext_namespace_encode.make
(Filename.remove_extension name)
?ns:!Clflags.dont_record_crc_unit
| Some oname ->
Filename.remove_extension oname


let process_interface_file ppf name =
Js_implementation.interface ppf name
~parser:Pparse_driver.parse_interface
(output_prefix name)
let process_implementation_file ppf name =
Js_implementation.implementation ppf name
~parser:Pparse_driver.parse_implementation
(output_prefix name)


let setup_error_printer (syntax_kind : [ `ml | `reason | `rescript ])=
Expand Down Expand Up @@ -67,20 +61,19 @@ let handle_reason (type a) (kind : a Ml_binary.kind) sourcefile ppf opref =







let process_file ppf sourcefile =
let process_file sourcefile
?(kind ) ppf =
(* This is a better default then "", it will be changed later
The {!Location.input_name} relies on that we write the binary ast
properly
*)
Location.set_input_name sourcefile;
let ext = Ext_filename.get_extension_maybe sourcefile in
let input = Ext_file_extensions.classify_input ext in
Location.set_input_name sourcefile;
let opref = output_prefix sourcefile in
match input with
let kind =
match kind with
| None -> Ext_file_extensions.classify_input (Ext_filename.get_extension_maybe sourcefile)
| Some kind -> kind in
match kind with
| Re -> handle_reason Ml sourcefile ppf opref
| Rei ->
handle_reason Mli sourcefile ppf opref
Expand Down Expand Up @@ -139,7 +132,7 @@ let anonymous ~(rev_args : string list) =
begin
match rev_args with
| [filename] ->
process_file ppf filename
process_file filename ppf
| [] -> ()
| _ ->
Bsc_args.bad_arg "can not handle multiple files"
Expand All @@ -148,10 +141,10 @@ let anonymous ~(rev_args : string list) =
(** used by -impl -intf *)
let impl filename =
Js_config.js_stdout := false;
process_implementation_file ppf filename;;
process_file filename ~kind:Ml ppf ;;
let intf filename =
Js_config.js_stdout := false ;
process_interface_file ppf filename;;
process_file filename ~kind:Mli ppf;;


let format_file input =
Expand Down
4 changes: 2 additions & 2 deletions lib/4.06.1/bsb.ml
Original file line number Diff line number Diff line change
Expand Up @@ -12948,7 +12948,7 @@ let make_custom_rules
~(digest : string)
~(refmt : string option) (* set refmt path when needed *)
~(package_specs: Bsb_package_specs.t)
~namespace
~(namespace : string option)
~package_name
~bsc
~warnings
Expand Down Expand Up @@ -12999,7 +12999,7 @@ let make_custom_rules
Ext_buffer.add_string buf package_name;
Ext_buffer.add_string buf (Bsb_package_specs.package_flag_of_package_specs package_specs "$in_d")
end;
Ext_buffer.add_string buf " -o $out $i";
Ext_buffer.add_string buf " $i";
begin match postbuild with
| None -> ()
| Some cmd ->
Expand Down
171 changes: 82 additions & 89 deletions lib/4.06.1/whole_compiler.ml
Original file line number Diff line number Diff line change
Expand Up @@ -366101,6 +366101,70 @@ let write_file f content =
end

end
module Ext_namespace_encode : sig
#1 "ext_namespace_encode.mli"
(* Copyright (C) 2020- Authors of BuckleScript
*
* 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
* (at your option) any later version.
*
* In addition to the permissions granted to you by the LGPL, you may combine
* or link a "work that uses the Library" with a publicly distributed version
* of this file to produce a combined library or application, then distribute
* that combined work under the terms of your choosing, with no requirement
* to comply with the obligations normally placed on you by section 4 of the
* LGPL version 3 (or the corresponding section of a later version of the LGPL
* should you choose to use a later version).
*
* This program is distributed in the hope that it will be useful,
* 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. *)

(** [make ~ns:"Ns" "a" ]
A typical example would return "a-Ns"
Note the namespace comes from the output of [namespace_of_package_name]
*)
val make :
?ns:string -> string -> string

end = struct
#1 "ext_namespace_encode.ml"
(* Copyright (C) 2020- Authors of BuckleScript
*
* 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
* (at your option) any later version.
*
* In addition to the permissions granted to you by the LGPL, you may combine
* or link a "work that uses the Library" with a publicly distributed version
* of this file to produce a combined library or application, then distribute
* that combined work under the terms of your choosing, with no requirement
* to comply with the obligations normally placed on you by section 4 of the
* LGPL version 3 (or the corresponding section of a later version of the LGPL
* should you choose to use a later version).
*
* This program is distributed in the hope that it will be useful,
* 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. *)

let make ?ns cunit =
match ns with
| None -> cunit
| Some ns -> cunit ^ Literals.ns_sep ^ ns
end
module Depend : sig
#1 "depend.mli"
(**************************************************************************)
Expand Down Expand Up @@ -367330,70 +367394,6 @@ end = struct

let hex_length = 32
end
module Ext_namespace_encode : sig
#1 "ext_namespace_encode.mli"
(* Copyright (C) 2020- Authors of BuckleScript
*
* 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
* (at your option) any later version.
*
* In addition to the permissions granted to you by the LGPL, you may combine
* or link a "work that uses the Library" with a publicly distributed version
* of this file to produce a combined library or application, then distribute
* that combined work under the terms of your choosing, with no requirement
* to comply with the obligations normally placed on you by section 4 of the
* LGPL version 3 (or the corresponding section of a later version of the LGPL
* should you choose to use a later version).
*
* This program is distributed in the hope that it will be useful,
* 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. *)

(** [make ~ns:"Ns" "a" ]
A typical example would return "a-Ns"
Note the namespace comes from the output of [namespace_of_package_name]
*)
val make :
?ns:string -> string -> string

end = struct
#1 "ext_namespace_encode.ml"
(* Copyright (C) 2020- Authors of BuckleScript
*
* 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
* (at your option) any later version.
*
* In addition to the permissions granted to you by the LGPL, you may combine
* or link a "work that uses the Library" with a publicly distributed version
* of this file to produce a combined library or application, then distribute
* that combined work under the terms of your choosing, with no requirement
* to comply with the obligations normally placed on you by section 4 of the
* LGPL version 3 (or the corresponding section of a later version of the LGPL
* should you choose to use a later version).
*
* This program is distributed in the hope that it will be useful,
* 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. *)

let make ?ns cunit =
match ns with
| None -> cunit
| Some ns -> cunit ^ Literals.ns_sep ^ ns
end
module Ext_modulename : sig
#1 "ext_modulename.mli"
(* Copyright (C) 2017 Authors of BuckleScript
Expand Down Expand Up @@ -436137,21 +436137,15 @@ end = struct
(***********************************************************************)

let output_prefix name =
let oname =
match !Clflags.output_name with
| None -> name
| Some n -> (Clflags.output_name := None; n) in
Filename.remove_extension oname
match !Clflags.output_name with
| None ->
Ext_namespace_encode.make
(Filename.remove_extension name)
?ns:!Clflags.dont_record_crc_unit
| Some oname ->
Filename.remove_extension oname


let process_interface_file ppf name =
Js_implementation.interface ppf name
~parser:Pparse_driver.parse_interface
(output_prefix name)
let process_implementation_file ppf name =
Js_implementation.implementation ppf name
~parser:Pparse_driver.parse_implementation
(output_prefix name)


let setup_error_printer (syntax_kind : [ `ml | `reason | `rescript ])=
Expand Down Expand Up @@ -436193,20 +436187,19 @@ let handle_reason (type a) (kind : a Ml_binary.kind) sourcefile ppf opref =







let process_file ppf sourcefile =
let process_file sourcefile
?(kind ) ppf =
(* This is a better default then "", it will be changed later
The {!Location.input_name} relies on that we write the binary ast
properly
*)
Location.set_input_name sourcefile;
let ext = Ext_filename.get_extension_maybe sourcefile in
let input = Ext_file_extensions.classify_input ext in
Location.set_input_name sourcefile;
let opref = output_prefix sourcefile in
match input with
let kind =
match kind with
| None -> Ext_file_extensions.classify_input (Ext_filename.get_extension_maybe sourcefile)
| Some kind -> kind in
match kind with
| Re -> handle_reason Ml sourcefile ppf opref
| Rei ->
handle_reason Mli sourcefile ppf opref
Expand Down Expand Up @@ -436265,7 +436258,7 @@ let anonymous ~(rev_args : string list) =
begin
match rev_args with
| [filename] ->
process_file ppf filename
process_file filename ppf
| [] -> ()
| _ ->
Bsc_args.bad_arg "can not handle multiple files"
Expand All @@ -436274,10 +436267,10 @@ let anonymous ~(rev_args : string list) =
(** used by -impl -intf *)
let impl filename =
Js_config.js_stdout := false;
process_implementation_file ppf filename;;
process_file filename ~kind:Ml ppf ;;
let intf filename =
Js_config.js_stdout := false ;
process_interface_file ppf filename;;
process_file filename ~kind:Mli ppf;;


let format_file input =
Expand Down