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

Commit 23c8915

Browse files
committed
clean up applying optional attribute
1 parent 15b76e2 commit 23c8915

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

cli/reactjs_jsx_ppx_v4.ml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,14 +1047,10 @@ let transformComponentDefinition nestedModules mapper structure returnStructures
10471047
| Pexp_fun (arg_label, _default, {ppat_loc}, expr) ->
10481048
if isLabelled arg_label || isOptional arg_label then
10491049
returnedExpression
1050-
((if isOptional arg_label then
1051-
(* { name: @optional name } *)
1052-
( {loc = ppat_loc; txt = Lident (getLabel arg_label)},
1053-
Pat.var ~attrs:optionalAttr
1054-
{txt = getLabel arg_label; loc = ppat_loc} )
1055-
else
1056-
( {loc = ppat_loc; txt = Lident (getLabel arg_label)},
1057-
Pat.var {txt = getLabel arg_label; loc = ppat_loc} ))
1050+
(( {loc = ppat_loc; txt = Lident (getLabel arg_label)},
1051+
Pat.var
1052+
~attrs:(if isOptional arg_label then optionalAttr else [])
1053+
{txt = getLabel arg_label; loc = ppat_loc} )
10581054
:: patterns)
10591055
expr
10601056
else returnedExpression patterns expr

0 commit comments

Comments
 (0)