Skip to content

Commit b0b4b30

Browse files
committed
pass along is_functor info
1 parent 4bffac3 commit b0b4b30

File tree

10 files changed

+527
-468
lines changed

10 files changed

+527
-468
lines changed

jscomp/core/lam.ml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,19 @@ type inline_attribute =
3535
| Never_inline
3636
| Default_inline
3737

38+
type is_a_functor =
39+
| Functor_yes
40+
| Functor_no
41+
| Functor_na
42+
3843
type function_attribute = {
39-
inline : inline_attribute
44+
inline : inline_attribute;
45+
is_a_functor : is_a_functor
4046
}
4147

4248
let default_fn_attr : function_attribute = {
43-
inline = Default_inline
49+
inline = Default_inline;
50+
is_a_functor = Functor_na
4451
}
4552
module Types = struct
4653

jscomp/core/lam.mli

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,14 @@ type inline_attribute =
2929
| Never_inline
3030
| Default_inline
3131

32+
type is_a_functor =
33+
| Functor_yes
34+
| Functor_no
35+
| Functor_na
36+
3237
type function_attribute = {
33-
inline : inline_attribute
38+
inline : inline_attribute;
39+
is_a_functor : is_a_functor
3440
}
3541

3642
val default_fn_attr : function_attribute

jscomp/core/lam_convert.ml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,9 @@ let convert_fn_attribute (attr : Lambda.function_attribute) : Lam.function_attri
447447
| Never_inline -> Never_inline
448448
| Unroll _
449449
| Default_inline -> Default_inline in
450-
Lam.{inline}
450+
let is_a_functor =
451+
if attr.is_a_functor then Lam.Functor_yes else Functor_no in
452+
Lam.{inline; is_a_functor}
451453

452454

453455

jscomp/core/lam_inline_util.ml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ let maybe_functor (name : string) =
3838
name.[0] >= 'A' && name.[0] <= 'Z'
3939

4040

41-
let should_be_functor (name : string) (lam : Lam.t) =
42-
maybe_functor name &&
43-
(match lam with Lfunction _ -> true | _ -> false)
41+
let should_be_functor (lam : Lam.t) =
42+
(match lam with Lfunction {attr = {is_a_functor = Functor_yes}} -> true | _ -> false)
4443

4544

jscomp/core/lam_inline_util.mli

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@
3333

3434
val maybe_functor : string -> bool
3535

36-
val should_be_functor : string -> Lam.t -> bool
36+
val should_be_functor : Lam.t -> bool

jscomp/core/lam_stats_export.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ let values_of_export
7474
only truly immutable values can be inlined
7575
*)
7676
then
77-
if Lam_inline_util.should_be_functor x.name lambda (* can also be submodule *)
77+
if Lam_inline_util.should_be_functor lambda (* can also be submodule *)
7878
then
7979
if Lam_closure.is_closed lambda (* TODO: seriealize more*)
8080
then Some lambda

jscomp/main/builtin_cmj_datasets.ml

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

lib/4.06.1/unstable/js_compiler.ml

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

lib/4.06.1/unstable/js_refmt_compiler.ml

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

lib/4.06.1/whole_compiler.ml

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

0 commit comments

Comments
 (0)