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

Commit 4bd6e6b

Browse files
committed
Clean up difference between v10 and v11 ppx so files are identical.
1 parent 396df51 commit 4bd6e6b

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

cli/react_jsx_common.ml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,7 @@ let raiseErrorMultipleReactComponent ~loc =
4141
raiseError ~loc
4242
"Only one component definition is allowed for each module. Move to a \
4343
submodule or other file if necessary."
44+
45+
let optionalAttr = ({txt = "ns.optional"; loc = Location.none}, PStr [])
46+
let extractUncurried typ = typ
47+
let removeArity binding = binding

cli/reactjs_jsx_v4.ml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ let getLabel str =
2727
| Optional str | Labelled str -> str
2828
| Nolabel -> ""
2929

30-
let optionalAttr = ({txt = "ns.optional"; loc = Location.none}, PStr [])
31-
let optionalAttrs = [optionalAttr]
30+
let optionalAttrs = [React_jsx_common.optionalAttr]
3231

3332
let constantString ~loc str =
3433
Ast_helper.Exp.constant ~loc (Pconst_string (str, None))
@@ -740,6 +739,7 @@ let transformStructureItem ~config item =
740739
config.hasReactComponent <- true;
741740
check_string_int_attribute_iter.structure_item
742741
check_string_int_attribute_iter item;
742+
let pval_type = React_jsx_common.extractUncurried pval_type in
743743
let coreTypeOfAttr = React_jsx_common.coreTypeOfAttrs pval_attributes in
744744
let typVarsOfCoreType =
745745
coreTypeOfAttr
@@ -810,6 +810,7 @@ let transformStructureItem ~config item =
810810
React_jsx_common.raiseErrorMultipleReactComponent ~loc:pstr_loc
811811
else (
812812
config.hasReactComponent <- true;
813+
let binding = React_jsx_common.removeArity binding in
813814
let coreTypeOfAttr =
814815
React_jsx_common.coreTypeOfAttrs binding.pvb_attributes
815816
in

0 commit comments

Comments
 (0)