This repository was archived by the owner on Jun 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 38
/
Copy pathparse.spec.js.snap
1360 lines (1317 loc) · 47.7 KB
/
parse.spec.js.snap
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`apply.js 1`] = `
";;foo (fun _ -> bla) blaz
;;foo (fun _ -> bla) blaz
;;foo ((fun _ -> bla)[@bs ]) blaz
;;foo (fun _ -> bla) (fun _ -> blaz)
;;List.map (fun x -> x + 1) myList
;;List.reduce (fun acc -> fun curr -> acc + curr) 0 myList
let unitUncurried = ((apply ())[@bs ])
;;call ~a:(((((a)[@ns.namedArgLoc ]) : int))[@ns.namedArgLoc ])"
`;
exports[`argument.js 1`] = `
"let foo ~a:((a)[@ns.namedArgLoc ]) = ((a ())[@bs ]) +. 1.
let a = ((fun () -> 2)[@bs ])
let bar = foo ~a:((a)[@ns.namedArgLoc ])
let comparisonResult =
((compare currentNode.value ~targetValue:((targetValue)[@ns.namedArgLoc ]))
[@bs ])
;;((callback firstNode ~y:((y)[@ns.namedArgLoc ]))[@bs ])
;;((document.createElementWithOptions \\"div\\"
(elementProps ~onClick:((fun _ -> Js.log \\"hello world\\")
[@ns.namedArgLoc ])))[@bs ])"
`;
exports[`array.js 1`] = `
"let x = [|1;2;3|]
let x = [|1;2;3|]
let x = [|(1 : int);(2 : int);(3 : int)|]"
`;
exports[`arrow.js 1`] = `
"let f x = x + 1
let f _ = Js.log \\"test\\"
let f () = Js.log \\"unit\\"
let f (Reducer (inst, comp)) = inst.render comp
let f (Instance) = ()
let f a b = a + b
let f 1 2 = ()
let f \\"stringPattern\\" = ()
let f \\"stringPattern\\" \\"stringPattern\\" = ()
let f () = ()
let f (a : int) (b : int) = a + b
let f _ _ = ()
let f [|a;b|] [|c;d|] = ((a + b) + c) + d
let f { a } = a + 1
let f { a; b } { c; d } = ((a + b) + c) + d
let f (a, b) = a + b
let f (a, b) (c, d) = ((a + b) + c) + d
let f exception Terminate = ()
let f exception Terminate exception Exit = ()
let f (lazy x) = ()
let f (lazy x) (lazy y) = ()
let f [] = ()
let f (x::xs) = x + (xs |. Belt.List.length)
let f (x : int) (y : int) = x + y
let f ~a:((a)[@ns.namedArgLoc ]) ~b:((b)[@ns.namedArgLoc ]) = a + b
let f ~a:((x)[@ns.namedArgLoc ]) ~b:((y)[@ns.namedArgLoc ]) = x + y
let f ~a:(((x : int))[@ns.namedArgLoc ]) ~b:(((y : int))[@ns.namedArgLoc ])
= x + y
let f ?a:(((a)[@ns.namedArgLoc ])= 1) ?b:(((b)[@ns.namedArgLoc ])= 2) c =
(a + b) + c
let f ?a:(((x)[@ns.namedArgLoc ])= 1) ?b:(((y)[@ns.namedArgLoc ])= 2) c =
(x + y) + c
let f ?a:((((x : int))[@ns.namedArgLoc ])= 1)
?b:((((y : int))[@ns.namedArgLoc ])= 2) c = (x + y) + c
let f ?a:((a)[@ns.namedArgLoc ]) ?b:((b)[@ns.namedArgLoc ]) c =
match (a, b) with | (Some a, Some b) -> (a + b) + c | _ -> 3
let f ?a:((x)[@ns.namedArgLoc ]) ?b:((y)[@ns.namedArgLoc ]) c =
match (x, y) with | (Some a, Some b) -> (a + b) + c | _ -> 3
let f ?a:(((x : int option))[@ns.namedArgLoc ])
?b:(((y : int option))[@ns.namedArgLoc ]) c =
match (x, y) with | (Some a, Some b) -> (a + b) + c | _ -> 3
let f a b = a + b
let f = ((fun () -> ())[@bs ])
let f = ((fun () -> ())[@bs ])
let f = ((fun a -> fun b -> fun c -> ())[@bs ])
let f = ((fun a -> fun b -> ((fun c -> fun d -> ())[@bs ]))[@bs ])
let f = ((fun a -> ((fun b -> ((fun c -> ())[@bs ]))[@bs ]))[@bs ])
let f =
((fun ~a:((a)[@ns.namedArgLoc ]) ->
fun b -> ((fun ~c:((c)[@ns.namedArgLoc ]) -> fun d -> ())
[@bs ][@attr ]))
[@bs ][@attr ])
let f =
((fun ~a:((a)[@ns.namedArgLoc ]) ->
fun ((b)[@attrOnB ]) ->
((fun ~c:((c)[@ns.namedArgLoc ]) -> fun ((d)[@attrOnD ]) -> ())
[@bs ][@attr ]))
[@bs ][@attr ])
let f list = list ()
;;match colour with
| Red when
(l = l') ||
(Clflags.classic.contents &&
((l = Nolabel) && (not (is_optional l'))))
-> (t1, t2)
| _ -> ()
let arr =
[|((fun _ -> doThings ()));((fun _ -> doThings ()));((fun _ -> doThings ()))|]
let list =
[(fun _ -> doThings ()); (fun _ -> doThings ()); (fun _ -> doThings ())]
let tuple =
((fun _ -> doThings ()), (fun _ -> doThings ()), (fun _ -> doThings ()))
;;fun _ -> doThings ()
let x =
Constructore
((fun _ -> copyChecklistItemCB ()), (fun _ -> copyChecklistItemCB ()))
let y =
\`Constructore
((fun _ -> copyChecklistItemCB ()), (fun _ -> copyChecklistItemCB ()))
let f list = list + 1"
`;
exports[`binary.js 1`] = `
";;node := (if newBalance == 2 then avl |. (rotateRight node) else node)
;;node := ((if newBalance == 2 then avl |. (rotateRight node) else node)
[@attr ])
let x = z |> (match z with | _ -> false)
let x = z |> ((match z with | _ -> false)[@attr ])
let x = z |> (assert z)
let x = z |> ((assert z)[@attr ])
let x = z |> (lazy z)
let x = z |> ((lazy z)[@attr ])
let x = z |> (try sideEffect () with | _ -> f ())
let x = z |> ((try sideEffect () with | _ -> f ())[@attr ])
let x = z |> for i = 0 to 10 do () done
let x = z |> ((for i = 0 to 10 do () done)[@attr ])
let x = z |> while condition do () done
let x = z |> ((while condition do () done)[@attr ])
let x = (a + (-1)) + (-2)
let x = (a + (((-1))[@attr ])) + (((-2))[@attr ])
let x = a - b
let x = a -. b
;;Constructor (a, b)
;;\`Constructor (a, b)
let _ = ((Constructor (a, b); \`Constructor (a, b))[@ns.braces ])
;;((library.getBalance account)[@bs ]) |.
(Promise.Js.catch (fun _ -> ((Promise.resolved None)[@ns.braces ])))"
`;
exports[`binaryNoEs6Arrow.js 1`] = `
";;if (color == Black) && ((sibling == None) || (parent == None)) then ()
;;if
((color == Black) && (color != Red)) &&
((sibling == None) || (parent == None))
then ()
;;match (color == Black) && ((sibling == None) || (parent == None)) with
| _ -> ()
;;match ((color == Black) && (color != Red)) &&
((sibling == None) || (parent == None))
with
| _ -> ()
;;try (color == Black) && ((sibling == None) || (parent == None))
with | _ -> ()
;;try
((color == Black) && (color == Red)) &&
((sibling == None) || (parent == None))
with | _ -> ()
;;while (color == Black) && ((sibling == None) || (parent == None)) do ()
done
;;while
((color == Black) && (color == Red)) &&
((sibling == None) || (parent == None))
do () done
;;((div
~onClick:((fun event ->
((match videoContainerRect with
| Some videoContainerRect ->
let newChapter =
({ startTime = (percent *. duration) } : Video.chapter) in
{ a; b } |. onChange
| _ -> ())
[@ns.braces ]))[@ns.namedArgLoc ][@ns.braces ])
~children:[] ())[@JSX ])
;;if inclusions.(index) <- (uid, url) then onChange inclusions"
`;
exports[`block.js 1`] = `
"let b =
((let module Array = Belt.Array in
([|1;2|] |. (Array.map (fun x -> x + 1))) |. Js.log)
[@ns.braces ])
let b =
((let open Belt.Array in ([|1;2|] |. (map (fun x -> x + 1))) |. Js.log)
[@ns.braces ])
let b = ((let exception QuitEarly in raise QuitEarly)[@ns.braces ])
let b = ((let a = 1 in let b = 2 in a + b)[@ns.braces ])
let b = ((let _ = sideEffect () in ())[@ns.braces ])
let b = ((let _ = sideEffect () in ())[@ns.braces ])
let b = ((a (); b (); c ())[@ns.braces ])
let b = ((a (); b (); (let a = 1 in f a))[@ns.braces ])
let b = ((let a = 1 in let b = 2 in ())[@ns.braces ])
let b =
((let module Array = Belt.Array in
let open Array in
let exception Terminate of int in
let a = 1 in
let b = 2 in
sideEffect ();
(let x = (1 + 2) |. (fun x -> x + 1) in raise (Terminate x)))
[@ns.braces ])
let b = ((f (); g (); h (); (let arr = [|1;2;3|] in ()))[@ns.braces ])
let res =
((let a = \\"a starts out as\\" in
(((print_string a; (let a = 20 in print_int a)))
[@ns.braces ]);
print_string a)
[@ns.braces ])
let res =
((let a = \\"first its a string\\" in
let a = 20 in print_int a; print_int a; print_int a)
[@ns.braces ])
let res =
((let a = \\"a is always a string\\" in
print_string a; (let b = 30 in print_int b))
[@ns.braces ])
let nestedLet = ((let _ = 1 in ())[@ns.braces ])
let nestedLet = ((let _ = 1 in 2)[@ns.braces ])
let init () = ((foo (1 == 1); [%assert 1 == 2])[@ns.braces ])
let init () = (([%assert 1 == 2]; foo (1 == 1); [%assert 1 == 2])
[@ns.braces ])
let f () = ((let x = 1 in fun _ -> ())[@ns.braces ])
let reifyStyle (type a) (x : 'a) =
(((let module Internal =
struct
type constructor
external canvasGradient : constructor = \\"CanvasGradient\\"[@@bs.val ]
external canvasPattern : constructor = \\"CanvasPattern\\"[@@bs.val ]
let instanceOf =
([%bs.raw {js|function(x,y) {return +(x instanceof y)}|js}] :
'a -> constructor -> bool)
end in
((if (Js.typeof x) = \\"string\\"
then Obj.magic String
else
if Internal.instanceOf x Internal.canvasGradient
then Obj.magic Gradient
else
if Internal.instanceOf x Internal.canvasPattern
then Obj.magic Pattern
else
raise
(Invalid_argument
\\"Unknown canvas style kind. Known values are: String, CanvasGradient, CanvasPattern\\")),
(Obj.magic x)))
[@ns.braces ]) : (a style * a))
let calc_fps t0 t1 = ((let delta = (t1 -. t0) /. 1000. in 1. /. delta)
[@ns.braces ])"
`;
exports[`bracedOrRecord.js 1`] = `
"let r = { expr with pexp_attributes = [||] }
let r = { a }
let r = { a = expr }
let r = { a = expr }
let r = { a = expr; b = expr2 }
let r = { f = (fun x -> x + b) }
let e = ((a)[@ns.braces ])
let e = ((a)[@ns.braces ])
let e = ((a; b ())[@ns.braces ])
let e = ((- a)[@ns.braces ])
let e = ((a + b)[@ns.braces ])
let e = ((if a then true else false)[@ns.braces ][@ns.ternary ])
let e = ((if a |> computation then true else false)
[@ns.braces ][@ns.ternary ])
let e = ((a.(0))[@ns.braces ])
let e = ((f b)[@ns.braces ])
let e = (((a.b).c)[@ns.braces ])
let e = ((arr.(x) <- 20)[@ns.braces ])
let e = ((fun x -> (x + 1) |> (doStuff config))[@ns.braces ])
let e = (((fun x -> x + 1) |> (doStuff config))[@ns.braces ])
let e = ((if fun x -> x + 1 then true else false)[@ns.braces ][@ns.ternary ])
let e = (((fun x -> x + 1) |> sideEffect; logToAnalytics Shady.ml)
[@ns.braces ])
let f = ((fun event -> (event.target).value)[@ns.braces ])
let f = ((fun event -> ((event.target).value : string))[@ns.braces ])
let x = ((let a = 1 in let b = 2 in a + b)[@ns.braces ])
;;(([((\\"\\\\n\\" |. React.string)[@ns.braces ])])[@JSX ])"
`;
exports[`bsObject.js 1`] = `
"let x = [%obj { age = 30 }]
let y = [%obj { age = 30 }]
let y = [%obj { age = 30; name = \\"steve\\" }]
let y = [%obj { age = 30; name = \\"steve\\" }]
let x = ((\\"age\\")[@ns.braces ])
let x = ((\\"age\\".(0))[@ns.braces ])
let x = ((\\"age\\" |. Js.log)[@ns.braces ])
let x = ((if \\"age\\" then true else false)[@ns.braces ][@ns.ternary ])
let x = ((\\"age\\" |. Js.log; (let foo = 1 in let bar = 2 in foo + bar))
[@ns.braces ])
let x =
((((if \\"age\\" then true else false)
[@ns.ternary ]);
(let foo = 1 in let bar = 2 in foo + bar))
[@ns.braces ])
let x = ((\\"age\\".(0); (let foo = 1 in let bar = 2 in foo + bar))[@ns.braces ])"
`;
exports[`coerce.js 1`] = `
"let foo (x : int) = (x :> int)
let foo x = ((x : t) :> int)"
`;
exports[`constants.js 1`] = `
"let x = true
let y = false
let txt = \\"a string\\"
let txtWithEscapedChar = \\"foo\\\\nbar\\"
let number = 1
let template = {js|amazing
multine
template
string
|js}
let complexNumber = 1.6
let x = 0b0000_0001
let int32 = 42l
let int64 = 42L
let x = (-44.20e99)
let x = (-44.20_34e99)
let x = (-44.20e+9)
let x = (-44.20e-9)
let x = (-44.20e-99_99)
let x = (-444_444.20e99)
let x = 44.20e99
let x = 44.20_34e99
let x = 44.20e+9
let x = 44.20e-9
let x = 44.20e-99_99
let x = 44e99
let x = 44_44e99
let x = 0x0
let x = 0X0
let x = 0xAA
let x = 0XA_A
let x = 0xAA.ff
let x = 0xAA.ff_ff
let x = 0xAA.ff_ffp10
let x = 0xAA.ff_ffp+10
let x = 0xAA.ff_ffp-10
let x = 0xAA.ff_ffp100_00
let x = 0xAA.ff_ffp+100_00
let x = 0xAA.ff_ffp-100_00
let x = 'a'
let x = '\\\\\\\\'
let x = '\\\\''
let x = '\\\\n'
let x = '\\\\t'
let x = '\\\\b'
let x = '\\\\r'
let x = ' '
let x = '\\\\017'
let x = '\\\\170'
let x = '\\\\179'
let () = ((getResult (); (-10))[@ns.braces ])
let x = \\"foo\\\\nbar\\"
let x = \\"foo\\\\nbar\\"
let x = \\"foo\\\\nbar\\"
let x = \\"\\\\\\\\abc\\"
let x = \\"'bar\\"
let x = \\"\\\\nbar\\"
let x = \\"\\\\tbar\\"
let x = \\"\\\\bbar\\"
let x = \\"\\\\rbar\\"
let x = \\" bar\\""
`;
exports[`constructor.js 1`] = `
"let x = Red
let y = Colors.Blue
let z = Rgb ()
let v = Vertex (1., 2., 3., 4.)
let colour = Shades.Colors.White
let u = ()"
`;
exports[`es6template.js 1`] = `
"let s = {js|foo|js}
let s = {js|multi
line
string
|js}
let s = foo
let s = {js|before|js} ^ foo
let s = {js|before |js} ^ foo
let s = {js|before |js} ^ foo
let s = foo ^ {js|after|js}
let s = foo ^ {js| after|js}
let s = foo ^ {js| after|js}
let s = foo ^ bar
let s = (foo ^ bar) ^ baz
let s = (foo ^ {js| |js}) ^ bar
let s = (((foo ^ {js| |js}) ^ bar) ^ {js| |js}) ^ baz
let s = ((({js| before |js} ^ foo) ^ {js| |js}) ^ bar) ^ {js| after |js}
let s =
((((({js|before |js} ^ foo) ^ {js| middle |js}) ^ bar) ^ {js| |js}) ^ baz)
^ {js| wow |js}
let s =
{js|
multiline
es6
template
expression
so convenient
:)
|js}
let s = {js|$dollar without $braces $interpolation|js}
let s = {json|null|json}
let x = {js|foo\`bar$\\\\foo|js}
let x = ((({js|foo\`bar$\\\\foo|js} ^ a) ^ {js| \` |js}) ^ b) ^ {js| \` xx|js}"
`;
exports[`extension.js 1`] = `
";;[%expr ]
;;[%expr.extension ]
;;[%expr.extension.with.args \\"argument\\"]
;;[%expr.extension.with.args fun x -> f x]
let x = ([%bs.raw \\"1\\"]) + ([%bs.raw \\"2\\"])"
`;
exports[`firstClassModule.js 1`] = `
"let makeSet (type s) cmp =
((let module S = (Set.Make)(struct type nonrec t = s
let compare = cmp end) in ((module
S) : (module Set.S with type elt = s)))
[@ns.braces ])
let three = ((module Three) : (module X_int))
let numbers = [|three;(module Four)|]
let numbers = (three, (module Four))
let numbers = [three; (module Four)]
let numbers = [|three;(module struct let x = 4 end)|]
let numbers = (three, (module struct let x = 4 end))
let numbers = [three; (module struct let x = 4 end)]
let plus m1 m2 = ((((module
struct let x = (to_int m1) + (to_int m2) end) : (module X_int)))
[@ns.braces ])
let plus m1 m2 = ((module
struct let x = (to_int m1) + (to_int m2) end) : (module X_int))
let unique_instance = ((module
struct module Query_handler = Unique
let this = Unique.create 0 end) : (module Query_handler_instance))
let build_instance (type a)
((module Q) : (module Query_handler with type config = a)) config =
((module
struct module Query_handler = Q
let this = Q.create config end) : (module Query_handler_instance))
let build_instance (type a)
((module Q) : (module Query_handler with type config = a)) config =
((((module
struct module Query_handler = Q
let this = Q.create config end) : (module Query_handler_instance)))
[@ns.braces ])
let unique_instance = build_instance (module Unique) 0
let build_dispatch_table handlers =
((let table = Hashtbl.create (module String) in
List.iter handlers
~f:((fun (((module I) : (module Query_handler_instance)) as instance)
->
Hashtbl.set table ~key:((I.Query_handler.name)
[@ns.namedArgLoc ]) ~data:((instance)[@ns.namedArgLoc ]))
[@ns.namedArgLoc ]) table)
[@ns.braces ])
;;(module Three)
;;((module Three) : (module X_int))
;;(module Teenager).(0)
;;((module Teenager) |. age) |. Js.log
;;((module Teenager).(0)) |. Js.log
;;((if ((module Teenager) |. age) |. isAdult
then Js.log \\"has responsibilities\\"
else Js.log \\"can play in the playground\\")[@ns.ternary ])
;;((if ((module Streets).(0)) |. isExpensive
then Js.log \\"big money\\"
else Js.log \\"affordable\\")[@ns.ternary ])
let () = ((((module Teenager) |. age) |. Js.log)[@ns.braces ])
let () = (((module Teenager).(0))[@ns.braces ])
let () =
((if ((module Teenager) |. age) |. isAdult
then Js.log \\"has responsibilities\\"
else Js.log \\"can play in the playground\\")
[@ns.braces ][@ns.ternary ])
let () =
((if ((module Streets).(0)) |. isExpensive
then Js.log \\"big money\\"
else Js.log \\"affordable\\")
[@ns.braces ][@ns.ternary ])
let () =
((let a = 1 in
let b = 2 in (module Teenager).(0); ((module Teenager) |. age) |. Js.log)
[@ns.braces ])
let () =
((let a = 1 in
let b = 2 in
((module Teenager) |. age) |. Js.log;
((if (((module Teenager).(0)) |. age) |. isAdult
then Js.log \\"has responsibilities\\"
else Js.log \\"can play in the playground\\")
[@ns.ternary ]))
[@ns.braces ])"
`;
exports[`float.js 1`] = `
";;1. /. 2.
;;3. *. 4.
;;2. ** 2.
;;10.2 +. 5.4
;;28.9 -. 13.8"
`;
exports[`for.js 1`] = `
";;for p = 0 to 10 do () done
;;for p = 10 downto 0 do () done
;;for p = a to b do () done
;;for p = a to b do let a = 1 in let b = 2 in a + b done
;;for p = 0 to x + 1 do () done"
`;
exports[`ident.js 1`] = `
"let x = foo
let y = Foo.Bar.x
let x = _identWithUnderscore
let x = _ident_ident
let x = _ident_ident_
let x = __ident__
let x = list
let x = Foo.Bar.list"
`;
exports[`if.js 1`] = `
";;if foo then true else false
;;if foo = 2 then let bar = 1 in let foo = 2 in bar + foo
let ifThenElse = if foo then lala else doStuff x y z
let ifElseIfThen =
if foo = bar
then f ()
else if foo = bar2 then f1 () else if foo = bar3 then f2 () else f3 ()
let x = (if true then 1 else 2) + (if false then 2 else 3)"
`;
exports[`infix.js 1`] = `
";;a |. (f b)
;;\\"string1\\" ^ \\"string2\\"
;;a <> b
;;a != b
;;a = b
;;a == b"
`;
exports[`jsx.js 1`] = `
"let _ = ((div ~children:[] ())[@JSX ])
let _ = ((div ~children:[] ())[@JSX ])
let _ = ((div ~className:((\\"menu\\")[@ns.namedArgLoc ]) ~children:[] ())
[@JSX ])
let _ = ((div ~className:((\\"menu\\")[@ns.namedArgLoc ]) ~children:[] ())
[@JSX ])
let _ = ((div ~className:((\\"menu\\")[@ns.namedArgLoc ]) ~children:[] ())
[@JSX ])
let _ = ((div ~className:((\\"menu\\")[@ns.namedArgLoc ]) ~children:[] ())
[@JSX ])
let _ =
((div ~className:((\\"menu\\")[@ns.namedArgLoc ])
~onClick:((fun _ -> Js.log \\"click\\")[@ns.namedArgLoc ][@ns.braces ])
~children:[] ())
[@JSX ])
let _ =
((div ~className:((\\"menu\\")[@ns.namedArgLoc ])
~onClick:((fun _ -> Js.log \\"click\\")[@ns.namedArgLoc ][@ns.braces ])
~children:[] ())
[@JSX ])
let _ = ((Navbar.createElement ~children:[] ())[@JSX ])
let _ = ((Navbar.createElement ~children:[] ())[@JSX ])
let _ = ((Navbar.createElement ~children:[] ())[@JSX ])
let _ =
((Navbar.createElement ~className:((\\"menu\\")[@ns.namedArgLoc ]) ~children:[]
())
[@JSX ])
let _ = ((Dot.Up.createElement ~children:[] ())[@JSX ])
let _ = ((Dot.Up.createElement ~children:[] ())[@JSX ])
let _ = ((Dot.Up.createElement ~children:[] ())[@JSX ])
let _ =
((Dot.Up.createElement
~children:[((Dot.low.createElement ~children:[] ())[@JSX ])] ())
[@JSX ])
let _ =
((Dot.Up.createElement
~children:[((Dot.Up.createElement ~children:[] ())[@JSX ])] ())
[@JSX ])
let _ =
((Dot.Up.createElement ~className:((\\"menu\\")[@ns.namedArgLoc ]) ~children:[]
())
[@JSX ])
let _ = ((Dot.low.createElement ~children:[] ())[@JSX ])
let _ = ((Dot.low.createElement ~children:[] ())[@JSX ])
let _ = ((Dot.low.createElement ~children:[] ())[@JSX ])
let _ =
((Dot.low.createElement
~children:[((Dot.Up.createElement ~children:[] ())[@JSX ])] ())
[@JSX ])
let _ =
((Dot.low.createElement
~children:[((Dot.low.createElement ~children:[] ())[@JSX ])] ())
[@JSX ])
let _ =
((Dot.low.createElement ~className:((\\"menu\\")[@ns.namedArgLoc ])
~children:[] ())
[@JSX ])
let _ = ((el ~punned:((punned)[@ns.namedArgLoc ]) ~children:[] ())[@JSX ])
let _ = ((el ?punned:((punned)[@ns.namedArgLoc ]) ~children:[] ())[@JSX ])
let _ = ((el ~punned:((punned)[@ns.namedArgLoc ]) ~children:[] ())[@JSX ])
let _ = ((el ?punned:((punned)[@ns.namedArgLoc ]) ~children:[] ())[@JSX ])
let _ = ((el ?a:((b)[@ns.namedArgLoc ]) ~children:[] ())[@JSX ])
let _ = ((el ?a:((b)[@ns.namedArgLoc ]) ~children:[] ())[@JSX ])
let _ = (([])[@JSX ])
let _ = (([])[@JSX ])
let _ =
((div ~className:((\\"menu\\")[@ns.namedArgLoc ])
~children:[((div ~className:((\\"submenu\\")[@ns.namedArgLoc ])
~children:[sub1] ())
[@JSX ]);
((div ~className:((\\"submenu\\")[@ns.namedArgLoc ])
~children:[sub2] ())
[@JSX ])] ())
[@JSX ])
let _ =
((div ~className:((\\"menu\\")[@ns.namedArgLoc ])
~children:[((div ~className:((\\"submenu\\")[@ns.namedArgLoc ])
~children:[sub1] ())
[@JSX ]);
((div ~className:((\\"submenu\\")[@ns.namedArgLoc ])
~children:[sub2] ())
[@JSX ])] ())
[@JSX ])
let _ = ((div ~children:child ())[@JSX ])
let _ = ((Foo.createElement ~children:(fun a -> 1) ())[@JSX ])
let _ =
((Foo.createElement ~children:((Foo2.createElement ~children:[] ())
[@JSX ]) ())
[@JSX ])
let _ = ((Foo.createElement ~children:[|a|] ())[@JSX ])
let _ = ((Foo.createElement ~children:(1, 2) ())[@JSX ])
let _ = ((Foo.createElement ~children:(1, 2) ())[@JSX ])
let _ =
((div ~children:[ident; [|1;2;3|]; ((call a b)[@ns.braces ]); (x.y).z] ())
[@JSX ])
let _ =
((Outer.createElement ~inner:((Inner.createElement ~children:[] ())
[@ns.namedArgLoc ][@JSX ]) ~children:[] ())
[@JSX ])
let _ =
((div ~onClick:((onClickHandler)[@ns.namedArgLoc ])
~children:[(([\\"foobar\\"])[@JSX ])] ())
[@JSX ])
let _ =
((Window.createElement
~style:(({
width = 10;
height = 10;
paddingTop = 10;
paddingLeft = 10;
paddingRight = 10;
paddingBottom = 10
})[@ns.namedArgLoc ]) ~children:[] ())
[@JSX ])
let _ =
((OverEager.createElement ~fiber:((Metal.fiber)[@ns.namedArgLoc ])
~children:[] ())
[@JSX ])
let arrayOfListOfJsx = [|(([])[@JSX ])|]
let arrayOfListOfJsx =
[|(([((Foo.createElement ~children:[] ())[@JSX ])])[@JSX ])|]
let arrayOfListOfJsx =
[|(([((Foo.createElement ~children:[] ())[@JSX ])])
[@JSX ]);(([((Bar.createElement ~children:[] ())[@JSX ])])[@JSX ])|]
let sameButWithSpaces = [|(([])[@JSX ])|]
let sameButWithSpaces =
[|(([((Foo.createElement ~children:[] ())[@JSX ])])[@JSX ])|]
let sameButWithSpaces =
[|(([((Foo.createElement ~children:[] ())[@JSX ])])
[@JSX ]);(([((Bar.createElement ~children:[] ())[@JSX ])])[@JSX ])|]
let sameButWithSpaces =
[|(([((Foo.createElement ~children:[] ())[@JSX ])])
[@JSX ]);(([((Bar.createElement ~children:[] ())[@JSX ])])[@JSX ])|]
let arrayOfJsx = [||]
let arrayOfJsx = [|((Foo.createElement ~children:[] ())[@JSX ])|]
let arrayOfJsx =
[|((Foo.createElement ~children:[] ())
[@JSX ]);((Bar.createElement ~children:[] ())[@JSX ])|]
let sameButWithSpaces = [||]
let sameButWithSpaces = [|((Foo.createElement ~children:[] ())[@JSX ])|]
let sameButWithSpaces =
[|((Foo.createElement ~children:[] ())
[@JSX ]);((Bar.createElement ~children:[] ())[@JSX ])|]
let _ = ((a ~children:[] ())[@JSX ]) < ((b ~children:[] ())[@JSX ])
let _ = ((a ~children:[] ())[@JSX ]) > ((b ~children:[] ())[@JSX ])
let _ = ((a ~children:[] ())[@JSX ]) < ((b ~children:[] ())[@JSX ])
let _ = ((a ~children:[] ())[@JSX ]) > ((b ~children:[] ())[@JSX ])
let y =
((Routes.createElement ~path:((Routes.stateToPath state)[@ns.namedArgLoc ])
~isHistorical:((true)[@ns.namedArgLoc ])
~onHashChange:((fun _oldPath ->
fun _oldUrl ->
fun newUrl ->
updater
(fun latestComponentBag ->
fun _ ->
((let currentActualPath =
Routes.hashOfUri newUrl in
let pathFromState =
Routes.stateToPath
latestComponentBag.state in
((if currentActualPath = pathFromState
then None
else
dispatchEventless
(State.UriNavigated
currentActualPath)
latestComponentBag ())
[@ns.ternary ]))
[@ns.braces ])) ())
[@ns.namedArgLoc ][@ns.braces ]) ~children:[] ())
[@JSX ])
let z =
((div
~style:((ReactDOMRe.Style.make ~width:((width)[@ns.namedArgLoc ])
~height:((height)[@ns.namedArgLoc ]) ~color:((color)
[@ns.namedArgLoc ]) ~backgroundColor:((backgroundColor)
[@ns.namedArgLoc ]) ~margin:((margin)[@ns.namedArgLoc ])
~padding:((padding)[@ns.namedArgLoc ]) ~border:((border)
[@ns.namedArgLoc ]) ~borderColor:((borderColor)
[@ns.namedArgLoc ])
~someOtherAttribute:((someOtherAttribute)[@ns.namedArgLoc ])
())[@ns.namedArgLoc ]) ~key:((string_of_int 1)
[@ns.namedArgLoc ]) ~children:[] ())
[@JSX ])
let omega =
((div
~aList:(([width;
height;
color;
backgroundColor;
margin;
padding;
border;
borderColor;
someOtherAttribute])[@ns.namedArgLoc ])
~key:((string_of_int 1)[@ns.namedArgLoc ]) ~children:[] ())
[@JSX ])
let someArray =
((div
~anArray:(([|width;height;color;backgroundColor;margin;padding;border;borderColor;someOtherAttribute|])
[@ns.namedArgLoc ]) ~key:((string_of_int 1)[@ns.namedArgLoc ])
~children:[] ())
[@JSX ])
let tuples =
((div
~aTuple:(((width, height, color, backgroundColor, margin, padding,
border, borderColor, someOtherAttribute,
definitelyBreakere))[@ns.namedArgLoc ])
~key:((string_of_int 1)[@ns.namedArgLoc ]) ~children:[] ())
[@JSX ])
let icon =
((Icon.createElement
~name:((match state.volume with
| v when v < 0.1 -> \\"sound-off\\"
| v when v < 0.11 -> \\"sound-min\\"
| v when v < 0.51 -> \\"sound-med\\"
| _ -> \\"sound-max\\")[@ns.namedArgLoc ][@ns.braces ])
~children:[] ())
[@JSX ])
let _ =
((MessengerSharedPhotosAlbumViewPhotoReact.createElement
?ref:((if (foo ## bar) == baz
then Some (foooooooooooooooooooooooo setRefChild)
else None)[@ns.namedArgLoc ][@ns.ternary ])
~key:((node ## legacy_attachment_id)[@ns.namedArgLoc ]) ~children:[] ())
[@JSX ])
let _ = ((Foo.createElement ~bar:((bar)[@ns.namedArgLoc ]) ~children:[] ())
[@JSX ])
let _ = ((Foo.createElement ?bar:((bar)[@ns.namedArgLoc ]) ~children:[] ())
[@JSX ])
let _ =
((Foo.createElement ?bar:((Baz.bar)[@ns.namedArgLoc ]) ~children:[] ())
[@JSX ])
let x = ((div ~children:[] ())[@JSX ])
let _ = ((div ~asd:((1)[@ns.namedArgLoc ]) ~children:[] ())[@JSX ])
;;(foo ## bar) #= ((bar ~children:[] ())[@JSX ])
;;foo #= ((bar ~children:[] ())[@JSX ])
;;foo #= ((bar ~children:[] ())[@JSX ])
let x = [|((div ~children:[] ())[@JSX ])|]
let z = ((div ~children:[] ())[@JSX ])
let z =
(((Button.createElement ~onClick:((handleStaleClick)[@ns.namedArgLoc ])
~children:[] ())[@JSX ]),
((Button.createElement ~onClick:((handleStaleClick)[@ns.namedArgLoc ])
~children:[] ())[@JSX ]))
let y = [|((div ~children:[] ())[@JSX ]);((div ~children:[] ())[@JSX ])|]
let y =
[|((Button.createElement ~onClick:((handleStaleClick)[@ns.namedArgLoc ])
~children:[] ())
[@JSX ]);((Button.createElement ~onClick:((handleStaleClick)
[@ns.namedArgLoc ]) ~children:[] ())
[@JSX ])|]
let _ =
((Description.createElement
~term:((Text.createElement ~text:((\\"Age\\")[@ns.namedArgLoc ])
~children:[] ())[@ns.namedArgLoc ][@ns.braces ][@JSX ])
~children:[child] ())
[@JSX ])
let _ =
((Description.createElement
~term:((Text.createElement ~text:((\\"Age\\")[@ns.namedArgLoc ])
~children:(([||])[@ns.namedArgLoc ]) ())
[@ns.namedArgLoc ][@ns.braces ]) ~children:[child] ())
[@JSX ])
let _ =
((Description.createElement
~term:((Text.createElement ~text:((\\"Age\\")[@ns.namedArgLoc ]) ())
[@ns.namedArgLoc ][@ns.braces ][@JSX ]) ~children:[child] ())
[@JSX ])
let _ =
((Description.createElement
~term:((Text.createElement ~superLongPunnedProp:((superLongPunnedProp)
[@ns.namedArgLoc ])
~anotherSuperLongOneCrazyLongThingHere:((anotherSuperLongOneCrazyLongThingHere)
[@ns.namedArgLoc ]) ~text:((\\"Age\\")[@ns.namedArgLoc ])
~children:[] ())[@ns.namedArgLoc ][@ns.braces ][@JSX ])
~children:[child] ())
[@JSX ])
let _ =
((Foo.createElement
~bar:((Baz.createElement ~superLongPunnedProp:((superLongPunnedProp)
[@ns.namedArgLoc ])
~anotherSuperLongOneCrazyLongThingHere:((anotherSuperLongOneCrazyLongThingHere)
[@ns.namedArgLoc ]) ~children:[] ())
[@ns.namedArgLoc ][@ns.braces ][@JSX ]) ~children:[] ())
[@JSX ])
let _ = ((div ~children:[((span ~children:[str \\"hello\\"] ())[@JSX ])] ())
[@JSX ])
let _ =
((description
~term:((text ~text:((\\"Age\\")[@ns.namedArgLoc ]) ~children:[] ())
[@ns.namedArgLoc ][@ns.braces ][@JSX ]) ~children:[child] ())
[@JSX ])
let _ =
((description
~term:((text ~text:((\\"Age\\")[@ns.namedArgLoc ]) ~children:(([||])
[@ns.namedArgLoc ]) ())[@ns.namedArgLoc ][@ns.braces ])
~children:[child] ())
[@JSX ])
let _ =
((description
~term:((text ~text:((\\"Age\\")[@ns.namedArgLoc ]) ~children:(([||])
[@ns.namedArgLoc ]))[@ns.namedArgLoc ][@ns.braces ][@JSX ])
~children:[child] ())
[@JSX ])
let _ =
((description ~term:((text ~text:((\\"Age\\")[@ns.namedArgLoc ]) ())
[@ns.namedArgLoc ][@ns.braces ][@JSX ]) ~children:[child] ())
[@JSX ])
let _ =
((description
~term:((div ~superLongPunnedProp:((superLongPunnedProp)
[@ns.namedArgLoc ])
~anotherSuperLongOneCrazyLongThingHere:((anotherSuperLongOneCrazyLongThingHere)
[@ns.namedArgLoc ]) ~text:((\\"Age\\")[@ns.namedArgLoc ])
~children:[] ())[@ns.namedArgLoc ][@ns.braces ][@JSX ])
~children:[child] ())
[@JSX ])
let _ =
((div ~onClick:((fun event -> handleChange event)
[@ns.namedArgLoc ][@ns.braces ]) ~children:[] ())
[@JSX ])
let _ =
((div ~onClick:((fun eventWithLongIdent -> handleChange eventWithLongIdent)
[@ns.namedArgLoc ][@ns.braces ]) ~children:[] ())
[@JSX ])
let _ =
((div
~onClick:((fun event -> ((Js.log event; handleChange event)
[@ns.braces ]))[@ns.namedArgLoc ][@ns.braces ])
~children:[] ())
[@JSX ])
let _ =
((StaticDiv.createElement
~onClick:((fun foo ->
fun bar ->
fun baz ->
fun lineBreak ->
fun identifier ->
((doStuff foo bar baz; bar lineBreak identifier)
[@ns.braces ]))[@ns.namedArgLoc ][@ns.braces ])
~children:[] ())
[@JSX ])
let _ =
((AttrDiv.createElement ~onClick:((fun event -> handleChange event)
[@ns.namedArgLoc ][@ns.braces ][@bar ]) ~children:[] ())
[@JSX ])
let _ =
((AttrDiv.createElement
~onClick:((fun eventLongIdentifier -> handleChange eventLongIdentifier)
[@ns.namedArgLoc ][@ns.braces ][@bar ]) ~children:[] ())
[@JSX ])
let _ =
((StaticDivNamed.createElement
~onClick:((fun ~foo:((foo)[@ns.namedArgLoc ]) ->
fun ~bar:((bar)[@ns.namedArgLoc ]) ->
fun ~baz:((baz)[@ns.namedArgLoc ]) ->
fun ~lineBreak:((lineBreak)[@ns.namedArgLoc ]) ->
fun ~identifier:((identifier)[@ns.namedArgLoc ]) ->
fun () -> bar lineBreak identifier)
[@ns.namedArgLoc ][@ns.braces ]) ~children:[] ())
[@JSX ])
let _ =
((div ~onClick:((fun e -> (((doStuff (); bar foo)[@ns.braces ]) : event))
[@ns.namedArgLoc ][@ns.braces ]) ~children:[] ())
[@JSX ])
let _ =
((div
~onClick:((fun e ->
fun e2 -> (((doStuff (); bar foo)[@ns.braces ]) : event))
[@ns.namedArgLoc ][@ns.braces ]) ~children:[] ())
[@JSX ])
let _ =
((div
~onClick:((fun foo ->
fun bar ->
fun baz ->
fun superLongIdent ->
fun breakLine -> (((doStuff (); bar foo)
[@ns.braces ]) : (event * event2 * event3 * event4
* event5)))
[@ns.namedArgLoc ][@ns.braces ]) ~children:[] ())
[@JSX ])
let _ =
((div
~onClick:((fun foo ->
fun bar ->
fun baz ->
fun superLongIdent ->
fun breakLine ->
(doStuff () : (event * event2 * event3 * event4 *
event5)))
[@ns.namedArgLoc ][@ns.braces ]) ~children:[] ())
[@JSX ])
let _ =
((div
~children:[(((match color with
| Black -> ReasonReact.string \\"black\\"
| Red -> ReasonReact.string \\"red\\"))
[@ns.braces ])] ())
[@JSX ])
let _ =
((div
~style:((ReactDOMRe.Style.make ~width:((\\"20px\\")[@ns.namedArgLoc ])
~height:((\\"20px\\")[@ns.namedArgLoc ]) ~borderRadius:((\\"100%\\")
[@ns.namedArgLoc ]) ~backgroundColor:((\\"red\\")
[@ns.namedArgLoc ]))[@ns.namedArgLoc ][@ns.braces ][@foo ])
~children:[] ())
[@JSX ])
let _ =
((Animated.createElement ~initialValue:((0.0)[@ns.namedArgLoc ])
~value:((value)[@ns.namedArgLoc ])
~children:((ReactDOMRe.Style.make ~width:((\\"20px\\")[@ns.namedArgLoc ])
~height:((\\"20px\\")[@ns.namedArgLoc ])
~borderRadius:((\\"100%\\")[@ns.namedArgLoc ])
~backgroundColor:((\\"red\\")[@ns.namedArgLoc ]))
[@ns.braces ]) ())
[@JSX ])
let _ =
((Animated.createElement ~initialValue:((0.0)[@ns.namedArgLoc ])
~value:((value)[@ns.namedArgLoc ])
~children:((fun value ->
((div
~style:((ReactDOMRe.Style.make ~width:((\\"20px\\")
[@ns.namedArgLoc ]) ~height:((\\"20px\\")
[@ns.namedArgLoc ])
~borderRadius:((\\"100%\\")[@ns.namedArgLoc ])
~backgroundColor:((\\"red\\")
[@ns.namedArgLoc ]))
[@ns.namedArgLoc ][@ns.braces ]) ~children:[] ())
[@JSX ]))[@ns.braces ]) ())
[@JSX ])
let _ =
((Animated.createElement ~initialValue:((0.0)[@ns.namedArgLoc ])
~value:((value)[@ns.namedArgLoc ])
~children:((fun value ->
(((div
~style:((ReactDOMRe.Style.make ~width:((\\"20px\\")
[@ns.namedArgLoc ]) ~height:((\\"20px\\")
[@ns.namedArgLoc ])
~borderRadius:((\\"100%\\")
[@ns.namedArgLoc ])