@@ -378,6 +378,9 @@ let transformUppercaseCall3 ~config modulePath mapper jsxExprLoc callExprLoc
378
378
let keyProp =
379
379
args |> List. filter (fun (arg_label , _ ) -> " key" = getLabel arg_label)
380
380
in
381
+ let makeID =
382
+ Exp. ident ~loc: callExprLoc {txt = ident ~suffix: " make" ; loc = callExprLoc}
383
+ in
381
384
match config.mode with
382
385
(* The new jsx transform *)
383
386
| "automatic" ->
@@ -397,12 +400,7 @@ let transformUppercaseCall3 ~config modulePath mapper jsxExprLoc callExprLoc
397
400
( Exp. ident {loc = Location. none; txt = Ldot (Lident " React" , " jsxs" )},
398
401
[] )
399
402
in
400
- Exp. apply ~attrs jsxExpr
401
- ([
402
- (nolabel, Exp. ident {txt = ident ~suffix: " make" ; loc = callExprLoc});
403
- (nolabel, props);
404
- ]
405
- @ key)
403
+ Exp. apply ~attrs jsxExpr ([(nolabel, makeID); (nolabel, props)] @ key)
406
404
| _ -> (
407
405
match (! childrenArg, keyProp) with
408
406
| None , (_ , keyExpr ) :: _ ->
@@ -412,19 +410,12 @@ let transformUppercaseCall3 ~config modulePath mapper jsxExprLoc callExprLoc
412
410
loc = Location. none;
413
411
txt = Ldot (Lident " React" , " createElementWithKey" );
414
412
})
415
- [
416
- (nolabel, Exp. ident {txt = ident ~suffix: " make" ; loc = callExprLoc});
417
- (nolabel, props);
418
- (nolabel, keyExpr);
419
- ]
413
+ [(nolabel, makeID); (nolabel, props); (nolabel, keyExpr)]
420
414
| None , [] ->
421
415
Exp. apply ~attrs
422
416
(Exp. ident
423
417
{loc = Location. none; txt = Ldot (Lident " React" , " createElement" )})
424
- [
425
- (nolabel, Exp. ident {txt = ident ~suffix: " make" ; loc = callExprLoc});
426
- (nolabel, props);
427
- ]
418
+ [(nolabel, makeID); (nolabel, props)]
428
419
| Some children , (_ , keyExpr ) :: _ ->
429
420
Exp. apply ~attrs
430
421
(Exp. ident
@@ -433,7 +424,7 @@ let transformUppercaseCall3 ~config modulePath mapper jsxExprLoc callExprLoc
433
424
txt = Ldot (Lident " React" , " createElementVariadicWithKey" );
434
425
})
435
426
[
436
- (nolabel, Exp. ident {txt = ident ~suffix: " make " ; loc = callExprLoc} );
427
+ (nolabel, makeID );
437
428
(nolabel, props);
438
429
(nolabel, children);
439
430
(nolabel, keyExpr);
@@ -445,11 +436,7 @@ let transformUppercaseCall3 ~config modulePath mapper jsxExprLoc callExprLoc
445
436
loc = Location. none;
446
437
txt = Ldot (Lident " React" , " createElementVariadic" );
447
438
})
448
- [
449
- (nolabel, Exp. ident {txt = ident ~suffix: " make" ; loc = callExprLoc});
450
- (nolabel, props);
451
- (nolabel, children);
452
- ])
439
+ [(nolabel, makeID); (nolabel, props); (nolabel, children)])
453
440
454
441
let transformLowercaseCall3 ~config mapper jsxExprLoc callExprLoc attrs
455
442
callArguments id =
0 commit comments