Skip to content

Commit 2a3ef14

Browse files
committed
more dce
1 parent 023e59b commit 2a3ef14

4 files changed

+6
-35
lines changed

jscomp/gentype/GenTypeCommon.ml

+1-6
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,7 @@ and variant = {
9292
unboxed: bool;
9393
}
9494

95-
and payload = {
96-
case: case;
97-
inlineRecord: bool; [@live]
98-
numArgs: int; [@live]
99-
t: type_;
100-
}
95+
and payload = {case: case; numArgs: int; [@live] t: type_}
10196

10297
type label = Nolabel | Label of string | OptLabel of string
10398

jscomp/gentype/TranslateCoreType.ml

-1
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,6 @@ and translateCoreType_ ~config ~typeVarsGen
204204
|> List.map (fun (label, _attributes, translation) ->
205205
{
206206
case = {label; labelJS = StringLabel label};
207-
inlineRecord = false;
208207
numArgs = 1;
209208
t = translation.type_;
210209
})

jscomp/gentype/TranslateTypeDeclarations.ml

+5-26
Original file line numberDiff line numberDiff line change
@@ -240,11 +240,6 @@ let traslateDeclarationKind ~config ~loc ~outputFileRelative ~resolver
240240
~recordRepresentation:Types.Record_regular;
241241
]
242242
in
243-
let inlineRecord =
244-
match constructorArgs with
245-
| Cstr_tuple _ -> false
246-
| Cstr_record _ -> true
247-
in
248243
let argTypes =
249244
argsTranslation
250245
|> List.map (fun {TranslateTypeExprFromTypes.type_} -> type_)
@@ -266,36 +261,21 @@ let traslateDeclarationKind ~config ~loc ~outputFileRelative ~resolver
266261
attributes,
267262
argTypes,
268263
importTypes,
269-
inlineRecord,
270264
recordValue |> Runtime.recordValueToString ))
271265
in
272266
let variantsNoPayload, variantsWithPayload =
273-
variants
274-
|> List.partition (fun (_, _, argTypes, _, _, _) -> argTypes = [])
267+
variants |> List.partition (fun (_, _, argTypes, _, _) -> argTypes = [])
275268
in
276269
let noPayloads =
277270
variantsNoPayload
278271
|> List.map
279-
(fun
280-
( name,
281-
attributes,
282-
_argTypes,
283-
_importTypes,
284-
_inlineRecord,
285-
recordValue )
286-
-> {((name, attributes) |> createCase) with label = recordValue})
272+
(fun (name, attributes, _argTypes, _importTypes, recordValue) ->
273+
{((name, attributes) |> createCase) with label = recordValue})
287274
in
288275
let payloads =
289276
variantsWithPayload
290277
|> List.map
291-
(fun
292-
( name,
293-
attributes,
294-
argTypes,
295-
_importTypes,
296-
inlineRecord,
297-
recordValue )
298-
->
278+
(fun (name, attributes, argTypes, _importTypes, recordValue) ->
299279
let type_ =
300280
match argTypes with
301281
| [type_] -> type_
@@ -305,7 +285,6 @@ let traslateDeclarationKind ~config ~loc ~outputFileRelative ~resolver
305285
{
306286
case =
307287
{((name, attributes) |> createCase) with label = recordValue};
308-
inlineRecord;
309288
numArgs;
310289
t = type_;
311290
})
@@ -324,7 +303,7 @@ let traslateDeclarationKind ~config ~loc ~outputFileRelative ~resolver
324303
in
325304
let importTypes =
326305
variants
327-
|> List.map (fun (_, _, _, importTypes, _, _) -> importTypes)
306+
|> List.map (fun (_, _, _, importTypes, _) -> importTypes)
328307
|> List.concat
329308
in
330309
{CodeItem.exportFromTypeDeclaration; importTypes} |> returnTypeDeclaration

jscomp/gentype/TranslateTypeExprFromTypes.ml

-2
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@ let translateConstr ~config ~paramsTranslation ~(path : Path.t) ~typeEnv =
134134
let case n name type_ =
135135
{
136136
case = {label = string_of_int n; labelJS = StringLabel name};
137-
inlineRecord = false;
138137
numArgs = 1;
139138
t = type_;
140139
}
@@ -411,7 +410,6 @@ and translateTypeExprFromTypes_ ~config ~typeVarsGen ~typeEnv
411410
|> List.map (fun (label, translation) ->
412411
{
413412
case = {label; labelJS = StringLabel label};
414-
inlineRecord = false;
415413
numArgs = 1;
416414
t = translation.type_;
417415
})

0 commit comments

Comments
 (0)