@@ -1510,6 +1510,10 @@ module V4 = struct
1510
1510
let fullModuleName = String. concat " $" fullModuleName in
1511
1511
fullModuleName
1512
1512
1513
+ let raiseErrorMultipleReactComponent ~loc =
1514
+ Location. raise_errorf ~loc
1515
+ " Each module should have one react component at most"
1516
+
1513
1517
(*
1514
1518
AST node builders
1515
1519
These functions help us build AST nodes that are needed when transforming a [@react.component] into a
@@ -2018,8 +2022,7 @@ module V4 = struct
2018
2022
| [_] ->
2019
2023
(* If there is another @react.component, throw error *)
2020
2024
if config.hasReactComponent then
2021
- Location. raise_errorf ~loc: pstr_loc
2022
- " Each module should have one react component at most"
2025
+ raiseErrorMultipleReactComponent ~loc: pstr_loc
2023
2026
else (
2024
2027
config.hasReactComponent < - true ;
2025
2028
let rec getPropTypes types ({ptyp_loc; ptyp_desc} as fullType ) =
@@ -2076,8 +2079,7 @@ module V4 = struct
2076
2079
let mapBinding binding =
2077
2080
if hasAttrOnBinding binding then
2078
2081
if config.hasReactComponent then
2079
- Location. raise_errorf ~loc: pstr_loc
2080
- " Each module should have one react component at most"
2082
+ raiseErrorMultipleReactComponent ~loc: pstr_loc
2081
2083
else (
2082
2084
config.hasReactComponent < - true ;
2083
2085
let bindingLoc = binding.pvb_loc in
@@ -2466,8 +2468,7 @@ module V4 = struct
2466
2468
| [_] ->
2467
2469
(* If there is another @react.component, throw error *)
2468
2470
if config.hasReactComponent then
2469
- Location. raise_errorf ~loc: psig_loc
2470
- " Each module should have one react component at most"
2471
+ raiseErrorMultipleReactComponent ~loc: psig_loc
2471
2472
else config.hasReactComponent < - true ;
2472
2473
let hasForwardRef = ref false in
2473
2474
let rec getPropTypes types ({ptyp_loc; ptyp_desc} as fullType ) =
0 commit comments