Skip to content

Commit 9e36cce

Browse files
committed
More dead code.
1 parent 54e4e38 commit 9e36cce

File tree

4 files changed

+7
-57
lines changed

4 files changed

+7
-57
lines changed

jscomp/gentype/EmitJs.ml

Lines changed: 4 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ let emitCodeItem ~config ~emitters ~moduleItemsEmitter ~env ~fileName
133133
match codeItem with
134134
| ImportValue {asPath; importAnnotation; type_; valueName} ->
135135
let importPath = importAnnotation.importPath in
136-
let importFile = importAnnotation.name in
137136
let firstNameInPath, restOfPath =
138137
match valueName = asPath with
139138
| true -> (valueName, "")
@@ -159,11 +158,6 @@ let emitCodeItem ~config ~emitters ~moduleItemsEmitter ~env ~fileName
159158
as function_)
160159
when retType |> EmitType.isTypeFunctionComponent ~fields ->
161160
(* JSX V3 *)
162-
let componentName =
163-
match importFile with
164-
| "." | ".." -> None
165-
| _ -> Some importFile
166-
in
167161
let fields =
168162
fields
169163
|> List.map (fun (field : field) ->
@@ -180,7 +174,7 @@ let emitCodeItem ~config ~emitters ~moduleItemsEmitter ~env ~fileName
180174
argTypes = [{aType = Object (closedFlag, fields); aName}];
181175
}
182176
in
183-
Function {function_ with componentName}
177+
Function function_
184178
| Function
185179
({argTypes = [{aType = Ident {name} as propsType; aName}]; retType} as
186180
function_)
@@ -189,11 +183,6 @@ let emitCodeItem ~config ~emitters ~moduleItemsEmitter ~env ~fileName
189183
match inlineOneLevel propsType with
190184
| Object (closedFlags, fields) ->
191185
(* JSX V3 *)
192-
let componentName =
193-
match importFile with
194-
| "." | ".." -> None
195-
| _ -> Some importFile
196-
in
197186
let fields =
198187
Ext_list.filter_map fields (fun (field : field) ->
199188
match field.nameJS with
@@ -210,7 +199,7 @@ let emitCodeItem ~config ~emitters ~moduleItemsEmitter ~env ~fileName
210199
argTypes = [{aType = Object (closedFlags, fields); aName}];
211200
}
212201
in
213-
Function {function_ with componentName}
202+
Function function_
214203
| _ -> type_)
215204
| _ -> type_
216205
in
@@ -276,26 +265,6 @@ let emitCodeItem ~config ~emitters ~moduleItemsEmitter ~env ~fileName
276265
typeVars: string list;
277266
}
278267
end in
279-
let getHookName () =
280-
let chopSuffix suffix =
281-
match resolvedNameStr = suffix with
282-
| true -> ""
283-
| false -> (
284-
match Filename.check_suffix resolvedNameStr ("_" ^ suffix) with
285-
| true -> Filename.chop_suffix resolvedNameStr ("_" ^ suffix)
286-
| false -> resolvedNameStr)
287-
in
288-
let suffix =
289-
if originalName = default then chopSuffix default
290-
else if originalName = make then chopSuffix make
291-
else resolvedNameStr
292-
in
293-
(fileName |> ModuleName.toString)
294-
^
295-
match suffix = "" with
296-
| true -> suffix
297-
| false -> "_" ^ suffix
298-
in
299268
let type_, hookType =
300269
match type_ with
301270
| Function
@@ -331,7 +300,7 @@ let emitCodeItem ~config ~emitters ~moduleItemsEmitter ~env ~fileName
331300
ResolvedName.fromString "Props")
332301
else ResolvedName.fromString name |> ResolvedName.dot "Props"
333302
in
334-
( Function {function_ with componentName = Some (getHookName ())},
303+
( Function function_,
335304
Some {HookType.propsType; resolvedTypeName; typeVars} )
336305
| Function
337306
({argTypes = [{aType = Ident {name} as propsType}]; retType} as
@@ -359,7 +328,7 @@ let emitCodeItem ~config ~emitters ~moduleItemsEmitter ~env ~fileName
359328
let function_ =
360329
{function_ with argTypes = [{aName = ""; aType = propsType}]}
361330
in
362-
Function {function_ with componentName = Some (getHookName ())}
331+
Function function_
363332
| _ -> type_
364333
in
365334
(compType, None)

jscomp/gentype/GenTypeCommon.ml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ and field = {
8282

8383
and function_ = {
8484
argTypes: argType list;
85-
componentName: string option; [@live]
8685
retType: type_;
8786
typeVars: string list;
8887
uncurried: bool; [@live]
@@ -169,8 +168,7 @@ let rec depToResolvedName (dep : dep) =
169168
| Internal resolvedName -> resolvedName
170169
| Dot (p, s) -> ResolvedName.dot s (p |> depToResolvedName)
171170

172-
let createVariant ~inherits ~noPayloads ~payloads ~polymorphic
173-
~unboxed =
171+
let createVariant ~inherits ~noPayloads ~payloads ~polymorphic ~unboxed =
174172
Variant {inherits; noPayloads; payloads; polymorphic; unboxed}
175173

176174
let ident ?(builtin = true) ?(typeArgs = []) name =

jscomp/gentype/TranslateCoreType.ml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -107,14 +107,7 @@ let rec translateArrowType ~config ~typeVarsGen ~noFunctionReturnDependencies
107107
let labeledConvertableTypes = revArgs |> List.rev in
108108
let argTypes = labeledConvertableTypes |> NamedArgs.group in
109109
let functionType =
110-
Function
111-
{
112-
argTypes;
113-
componentName = None;
114-
retType;
115-
typeVars = [];
116-
uncurried = false;
117-
}
110+
Function {argTypes; retType; typeVars = []; uncurried = false}
118111
in
119112
{dependencies = allDeps; type_ = functionType}
120113

jscomp/gentype/TranslateTypeExprFromTypes.ml

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,6 @@ let translateConstr ~config ~paramsTranslation ~(path : Path.t) ~typeEnv =
161161
Function
162162
{
163163
argTypes = [{aName = ""; aType = fromTranslation.type_}];
164-
componentName = None;
165164
retType = toTranslation.type_;
166165
typeVars = [];
167166
uncurried = false;
@@ -175,7 +174,6 @@ let translateConstr ~config ~paramsTranslation ~(path : Path.t) ~typeEnv =
175174
Function
176175
{
177176
argTypes = [{aName = ""; aType = propsTranslation.type_}];
178-
componentName = None;
179177
retType = retTranslation.type_;
180178
typeVars = [];
181179
uncurried = false;
@@ -189,7 +187,6 @@ let translateConstr ~config ~paramsTranslation ~(path : Path.t) ~typeEnv =
189187
Function
190188
{
191189
argTypes = [{aName = ""; aType = propsTranslation.type_}];
192-
componentName = None;
193190
retType = EmitType.typeReactElement;
194191
typeVars = [];
195192
uncurried = false;
@@ -328,14 +325,7 @@ let rec translateArrowType ~config ~typeVarsGen ~typeEnv ~revArgDeps ~revArgs
328325
let labeledConvertableTypes = revArgs |> List.rev in
329326
let argTypes = labeledConvertableTypes |> NamedArgs.group in
330327
let functionType =
331-
Function
332-
{
333-
argTypes;
334-
componentName = None;
335-
retType;
336-
typeVars = [];
337-
uncurried = false;
338-
}
328+
Function {argTypes; retType; typeVars = []; uncurried = false}
339329
in
340330
{dependencies = allDeps; type_ = functionType}
341331

0 commit comments

Comments
 (0)