Skip to content

Commit d7a9e1c

Browse files
committed
not saving empty submodule's arity
it is not useful in general
1 parent 2b63cbc commit d7a9e1c

12 files changed

+130
-111
lines changed

jscomp/core/builtin_cmj_datasets.ml

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

jscomp/core/lam_arity_analysis.ml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,17 @@ let rec get_arity (meta : Lam_stats.t) (lam : Lam.t) : Lam_arity.t =
4444
| Lvar v -> arity_of_var meta v
4545
| Lconst _ -> Lam_arity.non_function_arity_info
4646
| Llet(_,_,_, l ) -> get_arity meta l
47-
| Lprim {primitive = Pfield (_, Fld_module {name = fld_name});
47+
| Lprim {primitive = Pfield (_, Fld_module {name });
4848
args = [ Lglobal_module id ]; _} ->
49-
begin match (Lam_compile_env.query_external_id_info id fld_name).arity with
49+
begin match (Lam_compile_env.query_external_id_info id name).arity with
5050
| Single x -> x
5151
| Submodule _ -> Lam_arity.na
5252
end
5353
| Lprim {primitive = Pfield (m,_);
54-
args = [ Lprim{primitive = Pfield(n,Fld_module {name = fld_name});
54+
args = [ Lprim{primitive = Pfield(_,Fld_module {name });
5555
args = [ Lglobal_module id]} ]
5656
; _} ->
57-
begin match (Lam_compile_env.query_external_id_info id fld_name ).arity with
57+
begin match (Lam_compile_env.query_external_id_info id name).arity with
5858
| Submodule subs -> subs.(m) (* TODO: shall we store it as array?*)
5959
| Single _ -> Lam_arity.na
6060
end

jscomp/core/lam_compile.ml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -177,14 +177,14 @@ let rec
177177
compile_external_field (* Like [List.empty]*)
178178
(lamba_cxt : Lam_compile_context.t)
179179
(id : Ident.t)
180-
pos
180+
name
181181
: Js_output.t =
182-
match Lam_compile_env.query_external_id_info id pos with
182+
match Lam_compile_env.query_external_id_info id name with
183183
| { persistent_closed_lambda = Some lam}
184184
when Lam_util.not_function lam
185185
->
186186
compile_lambda lamba_cxt lam
187-
| { name} ->
187+
| _ ->
188188
Js_output.output_of_expression lamba_cxt.continuation
189189
~no_effects:no_effects_const
190190
(E.ml_var_dot id name )
@@ -254,7 +254,9 @@ and compile_external_field_apply
254254
E.call ~info:(call_info_of_ap_status ap_status) fn args
255255
| App_na ->
256256
match ident_info.arity with
257-
| Submodule _ -> E.call ~info:Js_call_info.dummy fn args
257+
| Submodule _
258+
| Single Arity_na
259+
-> E.call ~info:Js_call_info.dummy fn args
258260
| Single x ->
259261
apply_with_arity
260262
fn ~arity:(Lam_arity.extract_arity x) args

jscomp/core/lam_pass_remove_alias.ml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,8 @@ let simplify_alias
135135
end
136136
| _ -> true
137137
) ->
138-
simpl @@
139-
Lam_beta_reduce.propogate_beta_reduce
140-
meta params body args
138+
simpl (Lam_beta_reduce.propogate_beta_reduce
139+
meta params body args)
141140
| _ ->
142141
Lam.apply (simpl l1) (Ext_list.map args simpl) loc status
143142

jscomp/core/lam_stats_export.ml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,7 @@ let values_of_export
9999
match arity, persistent_closed_lambda with
100100
| Single Arity_na,
101101
(None | Some (Lconst (Const_pointer (_, Pt_module_alias)))) -> acc
102-
(* TODO: empty module can be saved too
103-
This is common since we have a module of externals quite common
104-
*)
102+
| Submodule [||], None -> acc
105103
| _ ->
106104
let cmj_value : Js_cmj_format.cmj_value =
107105
{arity ; persistent_closed_lambda } in

lib/4.06.1/bsb.ml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6522,7 +6522,9 @@ type file_kind =
65226522
| Upper_bs
65236523
| Little_js
65246524
| Little_bs
6525-
(** [js_name_of_modulename ~little A-Ns]
6525+
6526+
6527+
(** [js_name_of_modulename ~little A-Ns]
65266528
*)
65276529
val js_name_of_modulename :
65286530
string ->

lib/4.06.1/bsb_helper.ml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3760,7 +3760,9 @@ type file_kind =
37603760
| Upper_bs
37613761
| Little_js
37623762
| Little_bs
3763-
(** [js_name_of_modulename ~little A-Ns]
3763+
3764+
3765+
(** [js_name_of_modulename ~little A-Ns]
37643766
*)
37653767
val js_name_of_modulename :
37663768
string ->

lib/4.06.1/unstable/all_ounit_tests.ml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16393,7 +16393,9 @@ type file_kind =
1639316393
| Upper_bs
1639416394
| Little_js
1639516395
| Little_bs
16396-
(** [js_name_of_modulename ~little A-Ns]
16396+
16397+
16398+
(** [js_name_of_modulename ~little A-Ns]
1639716399
*)
1639816400
val js_name_of_modulename :
1639916401
string ->

lib/4.06.1/unstable/bsb_native.ml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6522,7 +6522,9 @@ type file_kind =
65226522
| Upper_bs
65236523
| Little_js
65246524
| Little_bs
6525-
(** [js_name_of_modulename ~little A-Ns]
6525+
6526+
6527+
(** [js_name_of_modulename ~little A-Ns]
65266528
*)
65276529
val js_name_of_modulename :
65286530
string ->

lib/4.06.1/unstable/js_compiler.ml

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

0 commit comments

Comments
 (0)