Skip to content
This repository was archived by the owner on Jun 15, 2023. It is now read-only.

Commit 44e0d10

Browse files
committed
clean up
1 parent 24d6bea commit 44e0d10

File tree

1 file changed

+15
-37
lines changed

1 file changed

+15
-37
lines changed

cli/reactjs_jsx_ppx.ml

Lines changed: 15 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1461,10 +1461,6 @@ module V4 = struct
14611461
(Invalid_argument "JSX: somehow there's more than one `children` label")
14621462
[@@raises Invalid_argument]
14631463

1464-
let unerasableIgnore loc =
1465-
( {loc; txt = "warning"},
1466-
PStr [Str.eval (Exp.constant (Pconst_string ("-16", None)))] )
1467-
14681464
let merlinFocus = ({loc = Location.none; txt = "merlin.focus"}, PStr [])
14691465

14701466
(* Helper method to look up the [@react.component] attribute *)
@@ -2148,13 +2144,6 @@ module V4 = struct
21482144
(expressionFn expression)
21492145
in
21502146
let expression = binding.pvb_expr in
2151-
let unerasableIgnoreExp exp =
2152-
{
2153-
exp with
2154-
pexp_attributes =
2155-
unerasableIgnore emptyLoc :: exp.pexp_attributes;
2156-
}
2157-
in
21582147
(* TODO: there is a long-tail of unsupported features inside of blocks - Pexp_letmodule , Pexp_letexception , Pexp_ifthenelse *)
21592148
let rec spelunkForFunExpression expression =
21602149
match expression with
@@ -2167,17 +2156,15 @@ module V4 = struct
21672156
pattern,
21682157
({pexp_desc = Pexp_fun _} as internalExpression) );
21692158
} ->
2170-
let wrap, hasUnit, hasForwardRef, exp =
2159+
let wrap, hasForwardRef, exp =
21712160
spelunkForFunExpression internalExpression
21722161
in
21732162
( wrap,
2174-
hasUnit,
21752163
hasForwardRef,
2176-
unerasableIgnoreExp
2177-
{
2178-
expression with
2179-
pexp_desc = Pexp_fun (label, default, pattern, exp);
2180-
} )
2164+
{
2165+
expression with
2166+
pexp_desc = Pexp_fun (label, default, pattern, exp);
2167+
} )
21812168
(* let make = (()) => ... *)
21822169
(* let make = (_) => ... *)
21832170
| {
@@ -2191,7 +2178,7 @@ module V4 = struct
21912178
},
21922179
_internalExpression );
21932180
} ->
2194-
((fun a -> a), true, false, expression)
2181+
((fun a -> a), false, expression)
21952182
(* let make = (~prop) => ... *)
21962183
| {
21972184
pexp_desc =
@@ -2201,14 +2188,13 @@ module V4 = struct
22012188
_pattern,
22022189
_internalExpression );
22032190
} ->
2204-
((fun a -> a), false, false, unerasableIgnoreExp expression)
2191+
((fun a -> a), false, expression)
22052192
(* let make = (prop) => ... *)
22062193
| {
22072194
pexp_desc =
22082195
Pexp_fun (_nolabel, _default, pattern, _internalExpression);
22092196
} ->
2210-
if !hasApplication then
2211-
((fun a -> a), false, false, unerasableIgnoreExp expression)
2197+
if !hasApplication then ((fun a -> a), false, expression)
22122198
else
22132199
Location.raise_errorf ~loc:pattern.ppat_loc
22142200
"React: props need to be labelled arguments.\n\
@@ -2219,11 +2205,10 @@ module V4 = struct
22192205
(* let make = {let foo = bar in (~prop) => ...} *)
22202206
| {pexp_desc = Pexp_let (recursive, vbs, internalExpression)} ->
22212207
(* here's where we spelunk! *)
2222-
let wrap, hasUnit, hasForwardRef, exp =
2208+
let wrap, hasForwardRef, exp =
22232209
spelunkForFunExpression internalExpression
22242210
in
22252211
( wrap,
2226-
hasUnit,
22272212
hasForwardRef,
22282213
{expression with pexp_desc = Pexp_let (recursive, vbs, exp)}
22292214
)
@@ -2233,38 +2218,31 @@ module V4 = struct
22332218
Pexp_apply (wrapperExpression, [(Nolabel, internalExpression)]);
22342219
} ->
22352220
let () = hasApplication := true in
2236-
let _, hasUnit, _, exp =
2237-
spelunkForFunExpression internalExpression
2238-
in
2221+
let _, _, exp = spelunkForFunExpression internalExpression in
22392222
let hasForwardRef = isForwardRef wrapperExpression in
22402223
( (fun exp -> Exp.apply wrapperExpression [(nolabel, exp)]),
2241-
hasUnit,
22422224
hasForwardRef,
22432225
exp )
22442226
| {
22452227
pexp_desc = Pexp_sequence (wrapperExpression, internalExpression);
22462228
} ->
2247-
let wrap, hasUnit, hasForwardRef, exp =
2229+
let wrap, hasForwardRef, exp =
22482230
spelunkForFunExpression internalExpression
22492231
in
22502232
( wrap,
2251-
hasUnit,
22522233
hasForwardRef,
22532234
{
22542235
expression with
22552236
pexp_desc = Pexp_sequence (wrapperExpression, exp);
22562237
} )
2257-
| e -> ((fun a -> a), false, false, e)
2238+
| e -> ((fun a -> a), false, e)
22582239
in
2259-
let wrapExpression, hasUnit, hasForwardRef, expression =
2240+
let wrapExpression, hasForwardRef, expression =
22602241
spelunkForFunExpression expression
22612242
in
2262-
( wrapExpressionWithBinding wrapExpression,
2263-
hasUnit,
2264-
hasForwardRef,
2265-
expression )
2243+
(wrapExpressionWithBinding wrapExpression, hasForwardRef, expression)
22662244
in
2267-
let bindingWrapper, _hasUnit, hasForwardRef, expression =
2245+
let bindingWrapper, hasForwardRef, expression =
22682246
modifiedBinding binding
22692247
in
22702248
(* do stuff here! *)

0 commit comments

Comments
 (0)