Skip to content

Commit a9253d8

Browse files
committed
make lfunction a separate type for easy analysis
1 parent ddefa46 commit a9253d8

File tree

2 files changed

+22
-16
lines changed

2 files changed

+22
-16
lines changed

jscomp/core/lam.ml

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ module Types = struct
4343
sw_blocks: (int * t) list;
4444
sw_failaction : t option;
4545
sw_names : Lambda.switch_names option }
46+
and lfunction = {
47+
arity : int ;
48+
params : ident list ;
49+
body : t;
50+
attr : function_attribute
51+
}
4652
(*
4753
Invariant:
4854
length (sw_consts) <= sw_consts_full
@@ -90,11 +96,7 @@ module Types = struct
9096
| Lglobal_module of ident
9197
| Lconst of Lam_constant.t
9298
| Lapply of apply_info
93-
| Lfunction of { arity : int ;
94-
params : ident list ;
95-
body : t;
96-
attr : function_attribute
97-
}
99+
| Lfunction of lfunction
98100
| Llet of Lam_compat.let_kind * ident * t * t
99101
| Lletrec of (ident * t) list * t
100102
| Lprim of prim_info
@@ -137,18 +139,21 @@ module X = struct
137139
ap_loc : Location.t;
138140
ap_status : apply_status
139141
}
142+
and lfunction = Types.lfunction =
143+
{
144+
arity : int ;
145+
params : ident list ;
146+
body : t;
147+
attr : function_attribute
148+
}
140149
and t
141150
= Types.t
142151
=
143152
| Lvar of ident
144153
| Lglobal_module of ident
145154
| Lconst of Lam_constant.t
146155
| Lapply of apply_info
147-
| Lfunction of { arity : int ;
148-
params : ident list ;
149-
body : t;
150-
attr : function_attribute
151-
}
156+
| Lfunction of lfunction
152157
| Llet of Lam_compat.let_kind * ident * t * t
153158
| Lletrec of (ident * t) list * t
154159
| Lprim of prim_info

jscomp/core/lam.mli

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,12 @@ and apply_info = private
4848
ap_loc : Location.t;
4949
ap_status : apply_status
5050
}
51-
51+
and lfunction = {
52+
arity : int ;
53+
params : ident list ;
54+
body : t ;
55+
attr : function_attribute;
56+
}
5257
and prim_info = private
5358
{ primitive : Lam_primitive.t ;
5459
args : t list ;
@@ -59,11 +64,7 @@ and t = private
5964
| Lglobal_module of ident
6065
| Lconst of Lam_constant.t
6166
| Lapply of apply_info
62-
| Lfunction of { arity : int ;
63-
params : ident list ;
64-
body : t ;
65-
attr : function_attribute;
66-
}
67+
| Lfunction of lfunction
6768
| Llet of Lam_compat.let_kind * ident * t * t
6869
| Lletrec of (ident * t) list * t
6970
| Lprim of prim_info

0 commit comments

Comments
 (0)