Skip to content

Commit e859fa5

Browse files
authored
Merge pull request #4180 from BuckleScript/bs_config
support [@@@bs.config {flags = [| .. |]}
2 parents 4aae054 + 149b199 commit e859fa5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+81575
-81603
lines changed

jscomp/common/js_config.ml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ let no_version_header = ref false
5353
let cross_module_inline = ref false
5454

5555
let get_cross_module_inline () = !cross_module_inline
56-
let set_cross_module_inline b =
57-
cross_module_inline := b
56+
(* let set_cross_module_inline b =
57+
cross_module_inline := b *)
5858

5959

6060
let diagnose = ref false
@@ -65,8 +65,8 @@ let get_diagnose () = !diagnose
6565

6666
(* let get_packages_info () = !packages_info *)
6767

68-
let no_builtin_ppx_ml = ref false
69-
let no_builtin_ppx_mli = ref false
68+
let no_builtin_ppx = ref false
69+
7070

7171

7272
let debug_file = ref ""

jscomp/common/js_config.mli

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ val get_package_name : unit -> string option *)
4848

4949
(** cross module inline option *)
5050
val cross_module_inline : bool ref
51-
val set_cross_module_inline : bool -> unit
51+
(* val set_cross_module_inline : bool -> unit *)
5252
val get_cross_module_inline : unit -> bool
5353

5454
(** diagnose option *)
@@ -58,8 +58,8 @@ val get_diagnose : unit -> bool
5858

5959

6060
(** options for builtin ppx *)
61-
val no_builtin_ppx_ml : bool ref
62-
val no_builtin_ppx_mli : bool ref
61+
val no_builtin_ppx : bool ref
62+
6363

6464

6565

jscomp/core/js_cmj_format.ml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,13 @@ let not_found key = {name = key; arity = single_na; persistent_closed_lambda =
132132

133133

134134
let get_result midVal =
135-
if midVal.persistent_closed_lambda = None ||
136-
Js_config.get_cross_module_inline () then midVal
137-
else {midVal with persistent_closed_lambda = None}
135+
match midVal.persistent_closed_lambda with
136+
| Some (Lconst (Const_js_null | Const_js_undefined | Const_js_true | Const_js_false ))
137+
| None ->
138+
midVal
139+
| Some _ ->
140+
if Js_config.get_cross_module_inline () then midVal
141+
else {midVal with persistent_closed_lambda = None}
138142

139143
let rec binarySearchAux arr lo hi (key : string) =
140144
let mid = (lo + hi)/2 in

jscomp/core/js_long.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,8 @@ let of_float (args : J.expression list ) =
165165
let compare (args : J.expression list) =
166166
int64_call "compare" args
167167

168-
let of_string (args : J.expression list) =
169-
int64_call "of_string" args
168+
(* let of_string (args : J.expression list) =
169+
int64_call "of_string" args *)
170170
let get64 = int64_call "get64"
171171
let float_of_bits = int64_call "float_of_bits"
172172
let bits_of_float = int64_call "bits_of_float"

jscomp/core/js_long.mli

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
type int64_call = J.expression list -> J.expression
3131

32-
val make_const : lo:Int32.t -> hi:Int32.t -> J.expression
32+
(* val make_const : lo:Int32.t -> hi:Int32.t -> J.expression *)
3333

3434
val of_const : int64 -> J.expression
3535

@@ -60,7 +60,7 @@ val equal_nullable : int64_call
6060
val to_float : int64_call
6161
val of_float : int64_call
6262
val compare : int64_call
63-
val of_string : int64_call
63+
(* val of_string : int64_call *)
6464
val float_of_bits : int64_call
6565
val bits_of_float : int64_call
6666
val get64 : int64_call

jscomp/core/lam_convert.mli

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
2424

2525

26-
val happens_to_be_diff:
27-
(int * Lambda.lambda) list -> int option
26+
(* val happens_to_be_diff:
27+
(int * Lambda.lambda) list -> int option *)
2828

2929

3030
(**

jscomp/core/lam_stats_export.ml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,11 @@ let values_of_export
6464
end
6565
in
6666
let persistent_closed_lambda =
67+
match Map_ident.find_opt export_map x with
68+
| Some Lconst (Const_js_null | Const_js_undefined | Const_js_true | Const_js_false ) | None as optlam -> optlam
69+
| Some lambda as optlam ->
6770
if not !Js_config.cross_module_inline then None
68-
else match Map_ident.find_opt export_map x with
69-
| Some lambda ->
71+
else
7072
if Lam_analysis.safe_to_inline lambda
7173
(* when inlning a non function, we have to be very careful,
7274
only truly immutable values can be inlined
@@ -90,12 +92,12 @@ let values_of_export
9092
then
9193
begin
9294
Ext_log.dwarn ~__POS__ "%s recorded for inlining @." x.name ;
93-
Some lambda
95+
optlam
9496
end
9597
else None
9698
else
9799
None
98-
| None -> None in
100+
in
99101
match arity, persistent_closed_lambda with
100102
| Single Arity_na,
101103
(None | Some (Lconst (Const_pointer (_, Pt_module_alias)))) -> acc

jscomp/core/ocaml_options.ml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@ let mk_I f =
4444
"-I", Arg.String f, "<dir> Add <dir> to the list of include directories"
4545
;;
4646

47-
let mk_impl f =
47+
(* let mk_impl f =
4848
"-impl", Arg.String f, "<file> Compile <file> as a .ml file"
49-
;;
49+
;; *)
5050

51-
let mk_intf f =
51+
(* let mk_intf f =
5252
"-intf", Arg.String f, "<file> Compile <file> as a .mli file"
53-
;;
53+
;; *)
5454

5555
let mk_intf_suffix f =
5656
"-intf-suffix", Arg.String f,
@@ -244,10 +244,10 @@ let mk_strict_formats f =
244244
\ to detect and fix invalid formats.)"
245245
;;
246246

247-
let mk__ f =
247+
(* let mk__ f =
248248
"-", Arg.String f,
249249
"<file> Treat <file> as a file name (even if it starts with `-')"
250-
;;
250+
;; *)
251251

252252
let show_config () =
253253
Config.print_config stdout;

jscomp/core/ocaml_options.mli

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424

2525

2626

27-
val mk_impl : (string -> unit) -> string * Arg.spec * string
28-
val mk_intf : (string -> unit) -> string * Arg.spec * string
29-
val mk__ : (string -> unit) -> string * Arg.spec * string
27+
(* val mk_impl : (string -> unit) -> string * Arg.spec * string *)
28+
(* val mk_intf : (string -> unit) -> string * Arg.spec * string *)
29+
(* val mk__ : (string -> unit) -> string * Arg.spec * string *)
3030
(**
3131
[ocaml_options] are command options inherited from ocaml
3232
bytecode compiler except three options

jscomp/main/builtin_cmj_datasets.ml

Lines changed: 23 additions & 23 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)