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
3 changes: 3 additions & 0 deletions Changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ Unreleased
attribute is redundant and unnecessary
([#675](https://github.com/melange-re/melange/issues/675),
[#678](https://github.com/melange-re/melange/pull/678))
- [melange]: remove old, unused CLI flags: `-bs-ns`, `-bs-cmi`, `-bs-cmj`,
`-bs-no-builtin-ppx`, `-bs-super-errors`
([#686](https://github.com/melange-re/melange/pull/686)).

1.0.0 2023-05-31
---------------
Expand Down
3 changes: 1 addition & 2 deletions bin/jsoo_main.ml
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,7 @@ let compile =
in
let typed_tree =
let { Typedtree.structure; coercion; shape = _; signature } =
Typemod.type_implementation_more modulename modulename modulename env
ast
Typemod.type_implementation modulename modulename modulename env ast
in
(* finalenv := c ; *)
types_signature := signature;
Expand Down
9 changes: 0 additions & 9 deletions bin/melc.ml
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@ let main: Melc_cli.t -> _ Cmdliner.Term.ret
bs_g;
bs_package_name;
bs_module_name;
bs_ns;
as_ppx;
as_pp;
no_alias_deps;
Expand All @@ -222,10 +221,7 @@ let main: Melc_cli.t -> _ Cmdliner.Term.ret
color;
bs_eval;
bs_cmi_only;
bs_cmi;
bs_cmj;
bs_no_version_header;
bs_no_builtin_ppx;
bs_cross_module_opt;
bs_diagnose;
where;
Expand Down Expand Up @@ -321,8 +317,6 @@ let main: Melc_cli.t -> _ Cmdliner.Term.ret
raise (Arg.Bad ("Can't pass both `-bs-package-output` and `-bs-module-type`"))
end;

Option.iter Js_packages_state.set_package_map bs_ns ;

if as_ppx then Js_config.as_ppx := as_ppx;
if as_pp then (
Js_config.as_pp := true;
Expand All @@ -338,11 +332,8 @@ let main: Melc_cli.t -> _ Cmdliner.Term.ret
Option.iter set_color_option color;

if bs_cmi_only then Js_config.cmi_only := bs_cmi_only;
if bs_cmi then Js_config.force_cmi := bs_cmi;
if bs_cmj then Js_config.force_cmj := bs_cmj;
if bs_no_version_header then
Js_config.no_version_header := bs_no_version_header;
if bs_no_builtin_ppx then Js_config.no_builtin_ppx := bs_no_builtin_ppx;
if bs_diagnose then Js_config.diagnose := bs_diagnose;
if where then print_standard_library ();
if verbose then Clflags.verbose := verbose;
Expand Down
62 changes: 16 additions & 46 deletions bin/melc_cli.ml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ type t = {
bs_g : bool;
bs_package_name : string option;
bs_module_name : string option;
bs_ns : string option;
as_ppx : bool;
as_pp : bool;
no_alias_deps : bool;
Expand All @@ -48,10 +47,7 @@ type t = {
color : string option;
bs_eval : string option;
bs_cmi_only : bool;
bs_cmi : bool;
bs_cmj : bool;
bs_no_version_header : bool;
bs_no_builtin_ppx : bool;
bs_cross_module_opt : bool option;
bs_diagnose : bool;
where : bool;
Expand Down Expand Up @@ -158,12 +154,6 @@ let bs_module_name =
in
Arg.(value & opt (some string) None & info [ "bs-module-name" ] ~doc)

let bs_ns =
let doc =
"Set package map, not only set package name but also use it as a namespace"
in
Arg.(value & opt (some string) None & info [ "bs-ns" ] ~doc)

let unboxed_types =
let doc = "Unannotated unboxable types will be unboxed" in
Arg.(value & flag & info [ "unboxed-types" ] ~doc)
Expand Down Expand Up @@ -313,22 +303,10 @@ module Internal = struct
let doc = "*internal* Stop after generating cmi file" in
Arg.(value & flag & info [ "bs-cmi-only" ] ~doc)

let bs_cmi =
let doc = "*internal* Not using cached cmi, always generate cmi" in
Arg.(value & flag & info [ "bs-cmi" ] ~doc)

let bs_cmj =
let doc = "*internal* Not using cached cmj, always generate cmj" in
Arg.(value & flag & info [ "bs-cmj" ] ~doc)

let bs_no_version_header =
let doc = "*internal*Don't print version header" in
Arg.(value & flag & info [ "bs-no-version-header" ] ~doc)

let bs_no_builtin_ppx =
let doc = "*internal* Disable built-in ppx" in
Arg.(value & flag & info [ "bs-no-builtin-ppx" ] ~doc)

let bs_cross_module_opt =
Arg.(
value & vflag None
Expand Down Expand Up @@ -460,24 +438,22 @@ let help =

module Compat = struct
(* The args in this module are accepted by the CLI but ignored. They exist
* for compatibility with currently published packages. *)
* for compatibility with OCaml compilation. *)

let doc = "Ignored. Kept for compatibility"
let bs_super_errors = Arg.(value & flag & info [ "bs-super-errors" ] ~doc)
let c = Arg.(value & flag & info [ "c" ] ~doc)
end

let parse help include_dirs alerts warnings output_name ppx open_modules
bs_package_output bs_module_type bs_syntax_only bs_g bs_package_name
bs_module_name bs_ns as_ppx as_pp no_alias_deps bs_gentype unboxed_types
bs_unsafe_empty_array nostdlib color bs_eval bs_cmi_only bs_cmi bs_cmj
bs_no_version_header bs_no_builtin_ppx bs_cross_module_opt bs_diagnose where
verbose keep_locs bs_no_check_div_by_zero bs_noassertfalse noassert bs_loc
impl intf intf_suffix g opaque preamble strict_sequence strict_formats
dtypedtree dparsetree drawlambda dsource version pp absname bin_annot i
nopervasives modules nolabels principal rectypes short_paths unsafe
warn_help warn_error bs_stop_after_cmj runtime filenames _bs_super_errors _c
=
bs_module_name as_ppx as_pp no_alias_deps bs_gentype unboxed_types
bs_unsafe_empty_array nostdlib color bs_eval bs_cmi_only
bs_no_version_header bs_cross_module_opt bs_diagnose where verbose keep_locs
bs_no_check_div_by_zero bs_noassertfalse noassert bs_loc impl intf
intf_suffix g opaque preamble strict_sequence strict_formats dtypedtree
dparsetree drawlambda dsource version pp absname bin_annot i nopervasives
modules nolabels principal rectypes short_paths unsafe warn_help warn_error
bs_stop_after_cmj runtime filenames _c =
{
help;
include_dirs;
Expand All @@ -492,7 +468,6 @@ let parse help include_dirs alerts warnings output_name ppx open_modules
bs_g;
bs_package_name;
bs_module_name;
bs_ns;
as_ppx;
as_pp;
no_alias_deps;
Expand All @@ -503,10 +478,7 @@ let parse help include_dirs alerts warnings output_name ppx open_modules
color;
bs_eval;
bs_cmi_only;
bs_cmi;
bs_cmj;
bs_no_version_header;
bs_no_builtin_ppx;
bs_cross_module_opt;
bs_diagnose;
where;
Expand Down Expand Up @@ -551,22 +523,20 @@ let cmd =
Term.(
const parse $ help $ include_dirs $ alerts $ warnings $ output_name $ ppx
$ open_modules $ Internal.bs_package_output $ Internal.bs_module_type
$ bs_syntax_only $ bs_g $ bs_package_name $ bs_module_name $ bs_ns
$ Internal.as_ppx $ Internal.as_pp $ Internal.no_alias_deps
$ Internal.bs_gentype $ unboxed_types $ Internal.bs_unsafe_empty_array
$ Internal.nostdlib $ color $ Internal.bs_eval $ Internal.bs_cmi_only
$ Internal.bs_cmi $ Internal.bs_cmj $ Internal.bs_no_version_header
$ Internal.bs_no_builtin_ppx $ Internal.bs_cross_module_opt
$ Internal.bs_diagnose $ where $ verbose $ keep_locs
$ Internal.bs_no_check_div_by_zero $ Internal.bs_noassertfalse
$ bs_syntax_only $ bs_g $ bs_package_name $ bs_module_name $ Internal.as_ppx
$ Internal.as_pp $ Internal.no_alias_deps $ Internal.bs_gentype
$ unboxed_types $ Internal.bs_unsafe_empty_array $ Internal.nostdlib $ color
$ Internal.bs_eval $ Internal.bs_cmi_only $ Internal.bs_no_version_header
$ Internal.bs_cross_module_opt $ Internal.bs_diagnose $ where $ verbose
$ keep_locs $ Internal.bs_no_check_div_by_zero $ Internal.bs_noassertfalse
$ Internal.noassert $ Internal.bs_loc $ Internal.impl $ Internal.intf
$ Internal.intf_suffix $ Internal.g $ Internal.opaque $ preamble
$ Internal.strict_sequence $ Internal.strict_formats $ Internal.dtypedtree
$ Internal.dparsetree $ Internal.drawlambda $ Internal.dsource $ version
$ pp $ absname $ bin_annot $ i $ Internal.nopervasives $ Internal.modules
$ Internal.nolabels $ Internal.principal $ Internal.rectypes
$ Internal.short_paths $ unsafe $ warn_help $ warn_error $ bs_stop_after_cmj
$ Internal.runtime $ filenames $ Compat.bs_super_errors $ Compat.c)
$ Internal.runtime $ filenames $ Compat.c)

(* Different than Ext_cli_args because we need to normalize `-w -foo` to
* `-w=-foo` *)
Expand Down
20 changes: 10 additions & 10 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions jscomp/common/js_config.cppo.ml
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,6 @@ let no_version_header = ref false
let cross_module_inline = ref false
let diagnose = ref false

let no_builtin_ppx = ref false

let tool_name = "Melange"

let check_div_by_zero = ref true
Expand All @@ -96,9 +94,6 @@ let debug = ref false
let cmi_only = ref false
let cmj_only = ref false

let force_cmi = ref false
let force_cmj = ref false

let refmt = ref None


Expand Down
5 changes: 0 additions & 5 deletions jscomp/common/js_config.mli
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@ val cross_module_inline : bool ref
val diagnose : bool ref
(** diagnose option *)

val no_builtin_ppx : bool ref
(** options for builtin ppx *)

val check_div_by_zero : bool ref
(** check-div-by-zero option *)

Expand All @@ -62,8 +59,6 @@ val cmi_only : bool ref
val cmj_only : bool ref

(* stopped after generating cmj *)
val force_cmi : bool ref
val force_cmj : bool ref
val refmt : string option ref
val js_stdout : bool ref
val all_module_aliases : bool ref
Expand Down
4 changes: 2 additions & 2 deletions jscomp/core/js_cmj_format.ml
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,11 @@ let for_sure_not_changed (name : string) (header : string) =
(* This may cause some build system always rebuild
maybe should not be turned on by default
*)
let to_file name ~check_exists (v : t) =
let to_file name (v : t) =
let s = Marshal.to_string v [] in
let cur_digest = Digest.string s in
let header = cur_digest in
if not (check_exists && for_sure_not_changed name header) then (
if not (for_sure_not_changed name header) then (
let oc = open_out_bin name in
output_string oc header;
output_string oc s;
Expand Down
20 changes: 10 additions & 10 deletions jscomp/core/js_cmj_format.mli
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(* 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 @@ -17,31 +17,31 @@
* 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. *)

(** Define intemediate format to be serialized for cross module optimization
*)

(** In this module,
currently only arity information is exported,
(** In this module,
currently only arity information is exported,

Short term: constant literals are also exported
Short term: constant literals are also exported

Long term:
Benefit? since Google Closure Compiler already did such huge amount of work
TODO: simple expression, literal small function can be stored,
TODO: simple expression, literal small function can be stored,
but what would happen if small function captures other environment
for example
for example

{[
let f = fun x -> g x
let f = fun x -> g x
]}

{[
let f = g
let f = g
]}
*)

Expand Down Expand Up @@ -86,7 +86,7 @@ val from_string : string -> t
(*
Note writing the file if its content is not changed
*)
val to_file : string -> check_exists:bool -> t -> unit
val to_file : string -> t -> unit

type path = string
type cmj_load_info = { cmj_table : t; package_path : path }
4 changes: 1 addition & 3 deletions jscomp/core/js_implementation.ml
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,7 @@ let after_parsing_impl ppf fname (ast : Parsetree.structure) =
let env = Res_compmisc.initial_env () in
Env.set_unit_name modulename;
let ({ Typedtree.structure = typedtree; coercion; _ } as implementation) =
Typemod.type_implementation_more
?check_exists:(if !Js_config.force_cmi then None else Some ())
fname outputprefix modulename env ast
Typemod.type_implementation fname outputprefix modulename env ast
in
let typedtree_coercion = (typedtree, coercion) in
print_if ppf Clflags.dump_typedtree Printtyped.implementation_with_coercion
Expand Down
4 changes: 0 additions & 4 deletions jscomp/core/js_packages_state.ml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ let output_info = ref None
let set_package_name name =
packages_info := Js_packages_info.from_name ~t:!packages_info name

let set_package_map module_name =
Bs_clflags.dont_record_crc_unit := Some module_name;
Clflags.open_modules := module_name :: !Clflags.open_modules

let update_npm_package_path ?module_name path =
packages_info :=
Js_packages_info.add_npm_package_path ?module_name !packages_info path
Expand Down
1 change: 0 additions & 1 deletion jscomp/core/js_packages_state.mli
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)

val set_package_name : string -> unit
val set_package_map : string -> unit
val get_packages_info : unit -> Js_packages_info.t
val get_packages_info_for_cmj : unit -> Js_packages_info.t
val update_npm_package_path : ?module_name:string -> string -> unit
Expand Down
4 changes: 1 addition & 3 deletions jscomp/core/lam_compile_main.ml
Original file line number Diff line number Diff line change
Expand Up @@ -291,9 +291,7 @@ js
coerced_input.export_map
in
(if not !Clflags.dont_write_files then
Js_cmj_format.to_file
~check_exists:(not !Js_config.force_cmj)
(output_prefix ^ Literals.suffix_cmj) cmj);
Js_cmj_format.to_file (output_prefix ^ Literals.suffix_cmj) cmj);
delayed_program
)
;;
Expand Down
Loading