Skip to content

Commit fdf1d16

Browse files
committed
snapshot
1 parent 600a38e commit fdf1d16

File tree

3 files changed

+48
-36
lines changed

3 files changed

+48
-36
lines changed

lib/4.06.1/unstable/js_compiler.ml

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -272913,8 +272913,7 @@ let getLabel str =
272913272913
| Optional str | Labelled str -> str
272914272914
| Nolabel -> ""
272915272915

272916-
let optionalAttr = ({txt = "ns.optional"; loc = Location.none}, PStr [])
272917-
let optionalAttrs = [optionalAttr]
272916+
let optionalAttr = [({txt = "ns.optional"; loc = Location.none}, PStr [])]
272918272917

272919272918
let constantString ~loc str =
272920272919
Ast_helper.Exp.constant ~loc (Pconst_string (str, None))
@@ -273098,7 +273097,7 @@ let recordFromProps ~loc ~removeKey callArguments =
273098273097
let id = getLabel arg_label in
273099273098
if isOptional arg_label then
273100273099
( {txt = Lident id; loc = pexp_loc},
273101-
{pexpr with pexp_attributes = optionalAttrs} )
273100+
{pexpr with pexp_attributes = optionalAttr} )
273102273101
else ({txt = Lident id; loc = pexp_loc}, pexpr)
273103273102
in
273104273103
let fields = props |> List.map processProp in
@@ -273175,9 +273174,9 @@ let makeLabelDecls ~loc namedTypeList =
273175273174
namedTypeList
273176273175
|> List.map (fun (isOptional, label, _, interiorType) ->
273177273176
if label = "key" then
273178-
Type.field ~loc ~attrs:optionalAttrs {txt = label; loc} interiorType
273177+
Type.field ~loc ~attrs:optionalAttr {txt = label; loc} interiorType
273179273178
else if isOptional then
273180-
Type.field ~loc ~attrs:optionalAttrs {txt = label; loc}
273179+
Type.field ~loc ~attrs:optionalAttr {txt = label; loc}
273181273180
(Typ.var @@ safeTypeFromValue @@ Labelled label)
273182273181
else
273183273182
Type.field ~loc {txt = label; loc}
@@ -273420,14 +273419,19 @@ let transformLowercaseCall3 ~config mapper jsxExprLoc callExprLoc attrs
273420273419
(nolabel, childrenExpr);
273421273420
]
273422273421
| nonEmptyProps ->
273423-
let propsRecord =
273424-
recordFromProps ~loc:Location.none ~removeKey:false nonEmptyProps
273422+
let propsCall =
273423+
Exp.apply
273424+
(Exp.ident
273425+
{loc = Location.none; txt = Ldot (Lident "ReactDOM", "domProps")})
273426+
(nonEmptyProps
273427+
|> List.map (fun (label, expression) ->
273428+
(label, mapper.expr mapper expression)))
273425273429
in
273426273430
[
273427273431
(* "div" *)
273428273432
(nolabel, componentNameExpr);
273429273433
(* ReactDOM.domProps(~className=blabla, ~foo=bar, ()) *)
273430-
(labelled "props", propsRecord);
273434+
(labelled "props", propsCall);
273431273435
(* [|moreCreateElementCallsHere|] *)
273432273436
(nolabel, childrenExpr);
273433273437
]
@@ -273560,14 +273564,14 @@ let argToType ~newtypes ~(typeConstraints : core_type option) types
273560273564
in
273561273565
match (type_, name, default) with
273562273566
| Some type_, name, _ when isOptional name ->
273563-
(true, getLabel name, [], {type_ with ptyp_attributes = optionalAttrs})
273567+
(true, getLabel name, [], {type_ with ptyp_attributes = optionalAttr})
273564273568
:: types
273565273569
| Some type_, name, _ -> (false, getLabel name, [], type_) :: types
273566273570
| None, name, _ when isOptional name ->
273567273571
( true,
273568273572
getLabel name,
273569273573
[],
273570-
Typ.var ~loc ~attrs:optionalAttrs (safeTypeFromValue name) )
273574+
Typ.var ~loc ~attrs:optionalAttr (safeTypeFromValue name) )
273571273575
:: types
273572273576
| None, name, _ when isLabelled name ->
273573273577
(false, getLabel name, [], Typ.var ~loc (safeTypeFromValue name)) :: types
@@ -273918,7 +273922,7 @@ let transformStructureItem ~config mapper item =
273918273922
{
273919273923
patternWithoutConstraint with
273920273924
ppat_attributes =
273921-
(if isOptional arg_label then optionalAttrs else [])
273925+
(if isOptional arg_label then optionalAttr else [])
273922273926
@ pattern.ppat_attributes;
273923273927
} )
273924273928
:: patternsWithLabel)
@@ -273934,7 +273938,7 @@ let transformStructureItem ~config mapper item =
273934273938
{
273935273939
pattern with
273936273940
ppat_attributes =
273937-
optionalAttrs @ pattern.ppat_attributes;
273941+
optionalAttr @ pattern.ppat_attributes;
273938273942
} )
273939273943
:: patternsWithNolabel)
273940273944
expr

lib/4.06.1/unstable/js_playground_compiler.ml

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -274376,8 +274376,7 @@ let getLabel str =
274376274376
| Optional str | Labelled str -> str
274377274377
| Nolabel -> ""
274378274378

274379-
let optionalAttr = ({txt = "ns.optional"; loc = Location.none}, PStr [])
274380-
let optionalAttrs = [optionalAttr]
274379+
let optionalAttr = [({txt = "ns.optional"; loc = Location.none}, PStr [])]
274381274380

274382274381
let constantString ~loc str =
274383274382
Ast_helper.Exp.constant ~loc (Pconst_string (str, None))
@@ -274561,7 +274560,7 @@ let recordFromProps ~loc ~removeKey callArguments =
274561274560
let id = getLabel arg_label in
274562274561
if isOptional arg_label then
274563274562
( {txt = Lident id; loc = pexp_loc},
274564-
{pexpr with pexp_attributes = optionalAttrs} )
274563+
{pexpr with pexp_attributes = optionalAttr} )
274565274564
else ({txt = Lident id; loc = pexp_loc}, pexpr)
274566274565
in
274567274566
let fields = props |> List.map processProp in
@@ -274638,9 +274637,9 @@ let makeLabelDecls ~loc namedTypeList =
274638274637
namedTypeList
274639274638
|> List.map (fun (isOptional, label, _, interiorType) ->
274640274639
if label = "key" then
274641-
Type.field ~loc ~attrs:optionalAttrs {txt = label; loc} interiorType
274640+
Type.field ~loc ~attrs:optionalAttr {txt = label; loc} interiorType
274642274641
else if isOptional then
274643-
Type.field ~loc ~attrs:optionalAttrs {txt = label; loc}
274642+
Type.field ~loc ~attrs:optionalAttr {txt = label; loc}
274644274643
(Typ.var @@ safeTypeFromValue @@ Labelled label)
274645274644
else
274646274645
Type.field ~loc {txt = label; loc}
@@ -274883,14 +274882,19 @@ let transformLowercaseCall3 ~config mapper jsxExprLoc callExprLoc attrs
274883274882
(nolabel, childrenExpr);
274884274883
]
274885274884
| nonEmptyProps ->
274886-
let propsRecord =
274887-
recordFromProps ~loc:Location.none ~removeKey:false nonEmptyProps
274885+
let propsCall =
274886+
Exp.apply
274887+
(Exp.ident
274888+
{loc = Location.none; txt = Ldot (Lident "ReactDOM", "domProps")})
274889+
(nonEmptyProps
274890+
|> List.map (fun (label, expression) ->
274891+
(label, mapper.expr mapper expression)))
274888274892
in
274889274893
[
274890274894
(* "div" *)
274891274895
(nolabel, componentNameExpr);
274892274896
(* ReactDOM.domProps(~className=blabla, ~foo=bar, ()) *)
274893-
(labelled "props", propsRecord);
274897+
(labelled "props", propsCall);
274894274898
(* [|moreCreateElementCallsHere|] *)
274895274899
(nolabel, childrenExpr);
274896274900
]
@@ -275023,14 +275027,14 @@ let argToType ~newtypes ~(typeConstraints : core_type option) types
275023275027
in
275024275028
match (type_, name, default) with
275025275029
| Some type_, name, _ when isOptional name ->
275026-
(true, getLabel name, [], {type_ with ptyp_attributes = optionalAttrs})
275030+
(true, getLabel name, [], {type_ with ptyp_attributes = optionalAttr})
275027275031
:: types
275028275032
| Some type_, name, _ -> (false, getLabel name, [], type_) :: types
275029275033
| None, name, _ when isOptional name ->
275030275034
( true,
275031275035
getLabel name,
275032275036
[],
275033-
Typ.var ~loc ~attrs:optionalAttrs (safeTypeFromValue name) )
275037+
Typ.var ~loc ~attrs:optionalAttr (safeTypeFromValue name) )
275034275038
:: types
275035275039
| None, name, _ when isLabelled name ->
275036275040
(false, getLabel name, [], Typ.var ~loc (safeTypeFromValue name)) :: types
@@ -275381,7 +275385,7 @@ let transformStructureItem ~config mapper item =
275381275385
{
275382275386
patternWithoutConstraint with
275383275387
ppat_attributes =
275384-
(if isOptional arg_label then optionalAttrs else [])
275388+
(if isOptional arg_label then optionalAttr else [])
275385275389
@ pattern.ppat_attributes;
275386275390
} )
275387275391
:: patternsWithLabel)
@@ -275397,7 +275401,7 @@ let transformStructureItem ~config mapper item =
275397275401
{
275398275402
pattern with
275399275403
ppat_attributes =
275400-
optionalAttrs @ pattern.ppat_attributes;
275404+
optionalAttr @ pattern.ppat_attributes;
275401275405
} )
275402275406
:: patternsWithNolabel)
275403275407
expr

lib/4.06.1/whole_compiler.ml

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -284755,8 +284755,7 @@ let getLabel str =
284755284755
| Optional str | Labelled str -> str
284756284756
| Nolabel -> ""
284757284757

284758-
let optionalAttr = ({txt = "ns.optional"; loc = Location.none}, PStr [])
284759-
let optionalAttrs = [optionalAttr]
284758+
let optionalAttr = [({txt = "ns.optional"; loc = Location.none}, PStr [])]
284760284759

284761284760
let constantString ~loc str =
284762284761
Ast_helper.Exp.constant ~loc (Pconst_string (str, None))
@@ -284940,7 +284939,7 @@ let recordFromProps ~loc ~removeKey callArguments =
284940284939
let id = getLabel arg_label in
284941284940
if isOptional arg_label then
284942284941
( {txt = Lident id; loc = pexp_loc},
284943-
{pexpr with pexp_attributes = optionalAttrs} )
284942+
{pexpr with pexp_attributes = optionalAttr} )
284944284943
else ({txt = Lident id; loc = pexp_loc}, pexpr)
284945284944
in
284946284945
let fields = props |> List.map processProp in
@@ -285017,9 +285016,9 @@ let makeLabelDecls ~loc namedTypeList =
285017285016
namedTypeList
285018285017
|> List.map (fun (isOptional, label, _, interiorType) ->
285019285018
if label = "key" then
285020-
Type.field ~loc ~attrs:optionalAttrs {txt = label; loc} interiorType
285019+
Type.field ~loc ~attrs:optionalAttr {txt = label; loc} interiorType
285021285020
else if isOptional then
285022-
Type.field ~loc ~attrs:optionalAttrs {txt = label; loc}
285021+
Type.field ~loc ~attrs:optionalAttr {txt = label; loc}
285023285022
(Typ.var @@ safeTypeFromValue @@ Labelled label)
285024285023
else
285025285024
Type.field ~loc {txt = label; loc}
@@ -285262,14 +285261,19 @@ let transformLowercaseCall3 ~config mapper jsxExprLoc callExprLoc attrs
285262285261
(nolabel, childrenExpr);
285263285262
]
285264285263
| nonEmptyProps ->
285265-
let propsRecord =
285266-
recordFromProps ~loc:Location.none ~removeKey:false nonEmptyProps
285264+
let propsCall =
285265+
Exp.apply
285266+
(Exp.ident
285267+
{loc = Location.none; txt = Ldot (Lident "ReactDOM", "domProps")})
285268+
(nonEmptyProps
285269+
|> List.map (fun (label, expression) ->
285270+
(label, mapper.expr mapper expression)))
285267285271
in
285268285272
[
285269285273
(* "div" *)
285270285274
(nolabel, componentNameExpr);
285271285275
(* ReactDOM.domProps(~className=blabla, ~foo=bar, ()) *)
285272-
(labelled "props", propsRecord);
285276+
(labelled "props", propsCall);
285273285277
(* [|moreCreateElementCallsHere|] *)
285274285278
(nolabel, childrenExpr);
285275285279
]
@@ -285402,14 +285406,14 @@ let argToType ~newtypes ~(typeConstraints : core_type option) types
285402285406
in
285403285407
match (type_, name, default) with
285404285408
| Some type_, name, _ when isOptional name ->
285405-
(true, getLabel name, [], {type_ with ptyp_attributes = optionalAttrs})
285409+
(true, getLabel name, [], {type_ with ptyp_attributes = optionalAttr})
285406285410
:: types
285407285411
| Some type_, name, _ -> (false, getLabel name, [], type_) :: types
285408285412
| None, name, _ when isOptional name ->
285409285413
( true,
285410285414
getLabel name,
285411285415
[],
285412-
Typ.var ~loc ~attrs:optionalAttrs (safeTypeFromValue name) )
285416+
Typ.var ~loc ~attrs:optionalAttr (safeTypeFromValue name) )
285413285417
:: types
285414285418
| None, name, _ when isLabelled name ->
285415285419
(false, getLabel name, [], Typ.var ~loc (safeTypeFromValue name)) :: types
@@ -285760,7 +285764,7 @@ let transformStructureItem ~config mapper item =
285760285764
{
285761285765
patternWithoutConstraint with
285762285766
ppat_attributes =
285763-
(if isOptional arg_label then optionalAttrs else [])
285767+
(if isOptional arg_label then optionalAttr else [])
285764285768
@ pattern.ppat_attributes;
285765285769
} )
285766285770
:: patternsWithLabel)
@@ -285776,7 +285780,7 @@ let transformStructureItem ~config mapper item =
285776285780
{
285777285781
pattern with
285778285782
ppat_attributes =
285779-
optionalAttrs @ pattern.ppat_attributes;
285783+
optionalAttr @ pattern.ppat_attributes;
285780285784
} )
285781285785
:: patternsWithNolabel)
285782285786
expr

0 commit comments

Comments
 (0)