@@ -93,10 +93,9 @@ let otherAttrsPure (loc, _) = loc.txt <> "react.component"
93
93
let hasAttrOnBinding { pvb_attributes } = find_opt hasAttr pvb_attributes <> None
94
94
95
95
(* Finds the name of the variable the binding is assigned to, otherwise raises Invalid_argument *)
96
- let rec getFnName binding =
96
+ let getFnName binding =
97
97
match binding with
98
- | { ppat_desc = Ppat_var { txt } } -> txt
99
- | { ppat_desc = Ppat_constraint (pat , _ ) } -> getFnName pat
98
+ | { pvb_pat = { ppat_desc = Ppat_var { txt } } } -> txt
100
99
| _ -> raise (Invalid_argument " react.component calls cannot be destructured." )
101
100
[@@ raises Invalid_argument ]
102
101
@@ -488,7 +487,7 @@ let jsxMapper () =
488
487
let bindingLoc = binding.pvb_loc in
489
488
let bindingPatLoc = binding.pvb_pat.ppat_loc in
490
489
let binding = { binding with pvb_pat = { binding.pvb_pat with ppat_loc = emptyLoc }; pvb_loc = emptyLoc } in
491
- let fnName = getFnName binding.pvb_pat in
490
+ let fnName = getFnName binding in
492
491
let internalFnName = fnName ^ " $Internal" in
493
492
let fullModuleName = makeModuleName fileName ! nestedModules fnName in
494
493
let modifiedBindingOld binding =
@@ -507,10 +506,6 @@ let jsxMapper () =
507
506
spelunkForFunExpression innerFunctionExpression
508
507
| { pexp_desc = Pexp_sequence (_wrapperExpression , innerFunctionExpression ) } ->
509
508
spelunkForFunExpression innerFunctionExpression
510
- | { pexp_desc = Pexp_newtype (_label , innerFunctionExpression ) } ->
511
- spelunkForFunExpression innerFunctionExpression
512
- | { pexp_desc = Pexp_constraint (innerFunctionExpression , _typ ) } ->
513
- spelunkForFunExpression innerFunctionExpression
514
509
| _ ->
515
510
raise
516
511
(Invalid_argument
0 commit comments