This repository has been archived by the owner on Jun 4, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 206
/
meta_ast_cmt.ml
1576 lines (1536 loc) · 52.5 KB
/
meta_ast_cmt.ml
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
open Types
open Typedtree
(* generated by ocamltarzan and adjusted:
- do not show the xxx_loc and xxx_env fields.
*)
module Ident = struct
let vof_t x =
Ocaml.VString (Ident.name x)
end
module Longident = struct
let vof_t x = Ocaml.VString "LongIdent"
end
module Path = struct
let vof_t x =
Ocaml.VString (Path.name x)
end
module Location = struct
let vof_t x = Ocaml.VUnit
end
module Env = struct
let vof_t x = Ocaml.VUnit
end
module Concr = struct
let vof_t x = Ocaml.VUnit
end
module Meths = struct
let vof_t f x = Ocaml.VUnit
end
module Primitive = struct
let vof_description x = Ocaml.VUnit
end
module Types = struct
let vof_value_description x = Ocaml.VUnit
let vof_class_declaration x = Ocaml.VUnit
let vof_class_type x = Ocaml.VUnit
let vof_class_signature x = Ocaml.VUnit
let vof_module_type x = Ocaml.VUnit
let vof_signature x = Ocaml.VUnit
let vof_type_declaration x = Ocaml.VUnit
let vof_exception_declaration x = Ocaml.VUnit
let vof_class_type_declaration x = Ocaml.VUnit
end
let vof_loc f x = Ocaml.VUnit
let vof_constant x = Ocaml.VUnit
let vof_constructor_description x = Ocaml.VUnit
let vof_label x = Ocaml.VUnit
let vof_row_desc x = Ocaml.VUnit
let vof_label_description x = Ocaml.VUnit
let vof_closed_flag x = Ocaml.VUnit
let vof_rec_flag x = Ocaml.VUnit
let vof_partial x = Ocaml.VUnit
let vof_optional x = Ocaml.VUnit
let vof_direction_flag x = Ocaml.VUnit
let vof_override_flag x = Ocaml.VUnit
let vof_mutable_flag x = Ocaml.VUnit
let vof_private_flag x = Ocaml.VUnit
let vof_virtual_flag x = Ocaml.VUnit
let rec vof_type_expr { desc = v_desc; level = v_level; id = v_id } =
let bnds = [] in
let arg = Ocaml.vof_int v_id in
let bnd = ("id", arg) in
let bnds = bnd :: bnds in
let arg = Ocaml.vof_int v_level in
let bnd = ("level", arg) in
let bnds = bnd :: bnds in
let arg = vof_type_desc v_desc in
let bnd = ("desc", arg) in let bnds = bnd :: bnds in Ocaml.VDict bnds
and vof_type_desc =
function
| Tvar v1 ->
let v1 = Ocaml.vof_option Ocaml.vof_string v1
in Ocaml.VSum (("Tvar", [ v1 ]))
| Tarrow ((v1, v2, v3, v4)) ->
let v1 = vof_label v1
and v2 = vof_type_expr v2
and v3 = vof_type_expr v3
and v4 = vof_commutable v4
in Ocaml.VSum (("Tarrow", [ v1; v2; v3; v4 ]))
| Ttuple v1 ->
let v1 = Ocaml.vof_list vof_type_expr v1
in Ocaml.VSum (("Ttuple", [ v1 ]))
| Tconstr ((v1, v2, v3)) ->
let v1 = Path.vof_t v1
and v2 = Ocaml.vof_list vof_type_expr v2
and v3 = Ocaml.vof_ref vof_abbrev_memo v3
in Ocaml.VSum (("Tconstr", [ v1; v2; v3 ]))
| Tobject ((v1, v2)) ->
let v1 = vof_type_expr v1
and v2 =
Ocaml.vof_ref
(Ocaml.vof_option
(fun (v1, v2) ->
let v1 = Path.vof_t v1
and v2 = Ocaml.vof_list vof_type_expr v2
in Ocaml.VTuple [ v1; v2 ]))
v2
in Ocaml.VSum (("Tobject", [ v1; v2 ]))
| Tfield ((v1, v2, v3, v4)) ->
let v1 = Ocaml.vof_string v1
and v2 = vof_field_kind v2
and v3 = vof_type_expr v3
and v4 = vof_type_expr v4
in Ocaml.VSum (("Tfield", [ v1; v2; v3; v4 ]))
| Tnil -> Ocaml.VSum (("Tnil", []))
| Tlink v1 -> let v1 = vof_type_expr v1 in Ocaml.VSum (("Tlink", [ v1 ]))
| Tsubst v1 -> let v1 = vof_type_expr v1 in Ocaml.VSum (("Tsubst", [ v1 ]))
| Tvariant v1 ->
let v1 = vof_row_desc v1 in Ocaml.VSum (("Tvariant", [ v1 ]))
| Tunivar v1 ->
let v1 = Ocaml.vof_option Ocaml.vof_string v1
in Ocaml.VSum (("Tunivar", [ v1 ]))
| Tpoly ((v1, v2)) ->
let v1 = vof_type_expr v1
and v2 = Ocaml.vof_list vof_type_expr v2
in Ocaml.VSum (("Tpoly", [ v1; v2 ]))
| Tpackage ((v1, v2, v3)) ->
let v1 = Path.vof_t v1
and v2 = Ocaml.vof_list Longident.vof_t v2
and v3 = Ocaml.vof_list vof_type_expr v3
in Ocaml.VSum (("Tpackage", [ v1; v2; v3 ]))
and
vof_row_desc {
row_fields = v_row_fields;
row_more = v_row_more;
row_bound = v_row_bound;
row_closed = v_row_closed;
row_fixed = v_row_fixed;
row_name = v_row_name
} =
let bnds = [] in
let arg =
Ocaml.vof_option
(fun (v1, v2) ->
let v1 = Path.vof_t v1
and v2 = Ocaml.vof_list vof_type_expr v2
in Ocaml.VTuple [ v1; v2 ])
v_row_name in
let bnd = ("row_name", arg) in
let bnds = bnd :: bnds in
let arg = Ocaml.vof_bool v_row_fixed in
let bnd = ("row_fixed", arg) in
let bnds = bnd :: bnds in
let arg = Ocaml.vof_bool v_row_closed in
let bnd = ("row_closed", arg) in
let bnds = bnd :: bnds in
let arg = Ocaml.vof_unit v_row_bound in
let bnd = ("row_bound", arg) in
let bnds = bnd :: bnds in
let arg = vof_type_expr v_row_more in
let bnd = ("row_more", arg) in
let bnds = bnd :: bnds in
let arg =
Ocaml.vof_list
(fun (v1, v2) ->
let v1 = vof_label v1
and v2 = vof_row_field v2
in Ocaml.VTuple [ v1; v2 ])
v_row_fields in
let bnd = ("row_fields", arg) in let bnds = bnd :: bnds in Ocaml.VDict bnds
and vof_row_field =
function
| Rpresent v1 ->
let v1 = Ocaml.vof_option vof_type_expr v1
in Ocaml.VSum (("Rpresent", [ v1 ]))
| Reither ((v1, v2, v3, v4)) ->
let v1 = Ocaml.vof_bool v1
and v2 = Ocaml.vof_list vof_type_expr v2
and v3 = Ocaml.vof_bool v3
and v4 = Ocaml.vof_ref (Ocaml.vof_option vof_row_field) v4
in Ocaml.VSum (("Reither", [ v1; v2; v3; v4 ]))
| Rabsent -> Ocaml.VSum (("Rabsent", []))
and vof_abbrev_memo =
function
| Mnil -> Ocaml.VSum (("Mnil", []))
| Mcons ((v1, v2, v3, v4, v5)) ->
let v1 = vof_private_flag v1
and v2 = Path.vof_t v2
and v3 = vof_type_expr v3
and v4 = vof_type_expr v4
and v5 = vof_abbrev_memo v5
in Ocaml.VSum (("Mcons", [ v1; v2; v3; v4; v5 ]))
| Mlink v1 ->
let v1 = Ocaml.vof_ref vof_abbrev_memo v1
in Ocaml.VSum (("Mlink", [ v1 ]))
and vof_field_kind =
function
| Fvar v1 ->
let v1 = Ocaml.vof_ref (Ocaml.vof_option vof_field_kind) v1
in Ocaml.VSum (("Fvar", [ v1 ]))
| Fpresent -> Ocaml.VSum (("Fpresent", []))
| Fabsent -> Ocaml.VSum (("Fabsent", []))
and vof_commutable =
function
| Cok -> Ocaml.VSum (("Cok", []))
| Cunknown -> Ocaml.VSum (("Cunknown", []))
| Clink v1 ->
let v1 = Ocaml.vof_ref vof_commutable v1
in Ocaml.VSum (("Clink", [ v1 ]))
let vof_type_expr_show_all x = vof_type_expr x
let vof_type_expr x = ()
let rec
vof_pattern {
pat_desc = v_pat_desc;
pat_loc = v_pat_loc;
pat_extra = v_pat_extra;
pat_type = v_pat_type;
pat_env = v_pat_env
} =
(*
let bnds = [] in
let arg = Env.vof_t v_pat_env in
let bnd = ("pat_env", arg) in
let bnds = bnd :: bnds in
let arg = vof_type_expr v_pat_type in
let bnd = ("pat_type", arg) in
let bnds = bnd :: bnds in
let arg =
Ocaml.vof_list
(fun (v1, v2) ->
let v1 = vof_pat_extra v1
and v2 = Location.vof_t v2
in Ocaml.VTuple [ v1; v2 ])
v_pat_extra in
let bnd = ("pat_extra", arg) in
let bnds = bnd :: bnds in
let arg = Location.vof_t v_pat_loc in
let bnd = ("pat_loc", arg) in
let bnds = bnd :: bnds in
let arg = vof_pattern_desc v_pat_desc in
let bnd = ("pat_desc", arg) in let bnds = bnd :: bnds in Ocaml.VDict bnds
*)
vof_pattern_desc v_pat_desc
and vof_pat_extra =
function
| Tpat_constraint v1 ->
let v1 = vof_core_type v1 in Ocaml.VSum (("Tpat_constraint", [ v1 ]))
| Tpat_type ((v1, v2)) ->
let v1 = Path.vof_t v1
and v2 = vof_loc Longident.vof_t v2
in Ocaml.VSum (("Tpat_type", [ v1; v2 ]))
| Tpat_unpack -> Ocaml.VSum (("Tpat_unpack", []))
and vof_pattern_desc =
function
| Tpat_any -> Ocaml.VSum (("Tpat_any", []))
| Tpat_var ((v1, v2)) ->
let v1 = Ident.vof_t v1
and v2 = vof_loc Ocaml.vof_string v2
in Ocaml.VSum (("Tpat_var", [ v1; v2 ]))
| Tpat_alias ((v1, v2, v3)) ->
let v1 = vof_pattern v1
and v2 = Ident.vof_t v2
and v3 = vof_loc Ocaml.vof_string v3
in Ocaml.VSum (("Tpat_alias", [ v1; v2; v3 ]))
| Tpat_constant v1 ->
let v1 = vof_constant v1 in Ocaml.VSum (("Tpat_constant", [ v1 ]))
| Tpat_tuple v1 ->
let v1 = Ocaml.vof_list vof_pattern v1
in Ocaml.VSum (("Tpat_tuple", [ v1 ]))
#if OCAML_VERSION >= 4010
| Tpat_construct ((v1, v2, v3, v4)) ->
let v1 = vof_loc Longident.vof_t v1
and v2 = vof_constructor_description v2
and v3 = Ocaml.vof_list vof_pattern v3
and v4 = Ocaml.vof_bool v4
in Ocaml.VSum (("Tpat_construct", [ v1; v2; v3; v4 ]))
#else
| Tpat_construct ((v1, v2, v3, v4, v5)) ->
let v1 = Path.vof_t v1
and v2 = vof_loc Longident.vof_t v2
and v3 = vof_constructor_description v3
and v4 = Ocaml.vof_list vof_pattern v4
and v5 = Ocaml.vof_bool v5
in Ocaml.VSum (("Tpat_construct", [ v1; v2; v3; v4; v5 ]))
#endif
| Tpat_variant ((v1, v2, v3)) ->
let v1 = vof_label v1
and v2 = Ocaml.vof_option vof_pattern v2
and v3 = Ocaml.vof_ref vof_row_desc v3
in Ocaml.VSum (("Tpat_variant", [ v1; v2; v3 ]))
#if OCAML_VERSION >= 4010
| Tpat_record ((v1, v2)) ->
let v1 =
Ocaml.vof_list
(fun (v1, v2, v3) ->
let v1 = vof_loc Longident.vof_t v1
and v2 = vof_label_description v2
and v3 = vof_pattern v3
in Ocaml.VTuple [ v1; v2; v3 ])
v1
and v2 = vof_closed_flag v2
in Ocaml.VSum (("Tpat_record", [ v1; v2 ]))
#else
| Tpat_record ((v1, v2)) ->
let v1 =
Ocaml.vof_list
(fun (v1, v2, v3, v4) ->
let v1 = Path.vof_t v1
and v2 = vof_loc Longident.vof_t v2
and v3 = vof_label_description v3
and v4 = vof_pattern v4
in Ocaml.VTuple [ v1; v2; v3; v4 ])
v1
and v2 = vof_closed_flag v2
in Ocaml.VSum (("Tpat_record", [ v1; v2 ]))
#endif
| Tpat_array v1 ->
let v1 = Ocaml.vof_list vof_pattern v1
in Ocaml.VSum (("Tpat_array", [ v1 ]))
| Tpat_or ((v1, v2, v3)) ->
let v1 = vof_pattern v1
and v2 = vof_pattern v2
and v3 = Ocaml.vof_option vof_row_desc v3
in Ocaml.VSum (("Tpat_or", [ v1; v2; v3 ]))
| Tpat_lazy v1 ->
let v1 = vof_pattern v1 in Ocaml.VSum (("Tpat_lazy", [ v1 ]))
and
vof_expression {
exp_desc = v_exp_desc;
exp_loc = v_exp_loc;
exp_extra = v_exp_extra;
exp_type = v_exp_type;
exp_env = v_exp_env
} =
(*
let bnds = [] in
let arg = Env.vof_t v_exp_env in
let bnd = ("exp_env", arg) in
let bnds = bnd :: bnds in
let arg = vof_type_expr v_exp_type in
let bnd = ("exp_type", arg) in
let bnds = bnd :: bnds in
let arg =
Ocaml.vof_list
(fun (v1, v2) ->
let v1 = vof_exp_extra v1
and v2 = Location.vof_t v2
in Ocaml.VTuple [ v1; v2 ])
v_exp_extra in
let bnd = ("exp_extra", arg) in
let bnds = bnd :: bnds in
let arg = Location.vof_t v_exp_loc in
let bnd = ("exp_loc", arg) in
let bnds = bnd :: bnds in
let arg = vof_expression_desc v_exp_desc in
let bnd = ("exp_desc", arg) in let bnds = bnd :: bnds in Ocaml.VDict bnds
*)
vof_expression_desc v_exp_desc
and vof_exp_extra =
function
| Texp_constraint ((v1, v2)) ->
let v1 = Ocaml.vof_option vof_core_type v1
and v2 = Ocaml.vof_option vof_core_type v2
in Ocaml.VSum (("Texp_constraint", [ v1; v2 ]))
#if OCAML_VERSION >= 4010
| Texp_open ((v1, v2, v3, v4)) ->
let v1 = vof_override_flag v1
and v2 = Path.vof_t v2
and v3 = vof_loc Longident.vof_t v3
and v4 = Env.vof_t v4
in Ocaml.VSum (("Texp_open", [ v1; v2; v3; v4 ]))
#else
| Texp_open ((v1, v2, v3)) ->
let v1 = Path.vof_t v1
and v2 = vof_loc Longident.vof_t v2
and v3 = Env.vof_t v3
in Ocaml.VSum (("Texp_open", [ v1; v2; v3 ]))
#endif
| Texp_poly v1 ->
let v1 = Ocaml.vof_option vof_core_type v1
in Ocaml.VSum (("Texp_poly", [ v1 ]))
| Texp_newtype v1 ->
let v1 = Ocaml.vof_string v1 in Ocaml.VSum (("Texp_newtype", [ v1 ]))
and vof_expression_desc =
function
| Texp_ident ((v1, v2, v3)) ->
let v1 = Path.vof_t v1
and v2 = vof_loc Longident.vof_t v2
and v3 = Types.vof_value_description v3
in Ocaml.VSum (("Texp_ident", [ v1; v2; v3 ]))
| Texp_constant v1 ->
let v1 = vof_constant v1 in Ocaml.VSum (("Texp_constant", [ v1 ]))
| Texp_let ((v1, v2, v3)) ->
let v1 = vof_rec_flag v1
and v2 =
Ocaml.vof_list
(fun (v1, v2) ->
let v1 = vof_pattern v1
and v2 = vof_expression v2
in Ocaml.VTuple [ v1; v2 ])
v2
and v3 = vof_expression v3
in Ocaml.VSum (("Texp_let", [ v1; v2; v3 ]))
| Texp_function ((v1, v2, v3)) ->
let v1 = vof_label v1
and v2 =
Ocaml.vof_list
(fun (v1, v2) ->
let v1 = vof_pattern v1
and v2 = vof_expression v2
in Ocaml.VTuple [ v1; v2 ])
v2
and v3 = vof_partial v3
in Ocaml.VSum (("Texp_function", [ v1; v2; v3 ]))
| Texp_apply ((v1, v2)) ->
let v1 = vof_expression v1
and v2 =
Ocaml.vof_list
(fun (v1, v2, v3) ->
let v1 = vof_label v1
and v2 = Ocaml.vof_option vof_expression v2
and v3 = vof_optional v3
in Ocaml.VTuple [ v1; v2; v3 ])
v2
in Ocaml.VSum (("Texp_apply", [ v1; v2 ]))
| Texp_match ((v1, v2, v3)) ->
let v1 = vof_expression v1
and v2 =
Ocaml.vof_list
(fun (v1, v2) ->
let v1 = vof_pattern v1
and v2 = vof_expression v2
in Ocaml.VTuple [ v1; v2 ])
v2
and v3 = vof_partial v3
in Ocaml.VSum (("Texp_match", [ v1; v2; v3 ]))
| Texp_try ((v1, v2)) ->
let v1 = vof_expression v1
and v2 =
Ocaml.vof_list
(fun (v1, v2) ->
let v1 = vof_pattern v1
and v2 = vof_expression v2
in Ocaml.VTuple [ v1; v2 ])
v2
in Ocaml.VSum (("Texp_try", [ v1; v2 ]))
| Texp_tuple v1 ->
let v1 = Ocaml.vof_list vof_expression v1
in Ocaml.VSum (("Texp_tuple", [ v1 ]))
#if OCAML_VERSION >= 4010
| Texp_construct ((v1, v2, v3, v4)) ->
let v1 = vof_loc Longident.vof_t v1
and v2 = vof_constructor_description v2
and v3 = Ocaml.vof_list vof_expression v3
and v4 = Ocaml.vof_bool v4
in Ocaml.VSum (("Texp_construct", [ v1; v2; v3; v4 ]))
#else
| Texp_construct ((v1, v2, v3, v4, v5)) ->
let v1 = Path.vof_t v1
and v2 = vof_loc Longident.vof_t v2
and v3 = vof_constructor_description v3
and v4 = Ocaml.vof_list vof_expression v4
and v5 = Ocaml.vof_bool v5
in Ocaml.VSum (("Texp_construct", [ v1; v2; v3; v4; v5 ]))
#endif
| Texp_variant ((v1, v2)) ->
let v1 = vof_label v1
and v2 = Ocaml.vof_option vof_expression v2
in Ocaml.VSum (("Texp_variant", [ v1; v2 ]))
#if OCAML_VERSION >= 4010
| Texp_record ((v1, v2)) ->
let v1 =
Ocaml.vof_list
(fun (v1, v2, v3) ->
let v1 = vof_loc Longident.vof_t v1
and v2 = vof_label_description v2
and v3 = vof_expression v3
in Ocaml.VTuple [ v1; v2; v3 ])
v1
and v2 = Ocaml.vof_option vof_expression v2
in Ocaml.VSum (("Texp_record", [ v1; v2 ]))
| Texp_field ((v1, v2, v3)) ->
let v1 = vof_expression v1
and v2 = vof_loc Longident.vof_t v2
and v3 = vof_label_description v3
in Ocaml.VSum (("Texp_field", [ v1; v2; v3 ]))
| Texp_setfield ((v1, v2, v3, v4)) ->
let v1 = vof_expression v1
and v2 = vof_loc Longident.vof_t v2
and v3 = vof_label_description v3
and v4 = vof_expression v4
in Ocaml.VSum (("Texp_setfield", [ v1; v2; v3; v4 ]))
#else
| Texp_record ((v1, v2)) ->
let v1 =
Ocaml.vof_list
(fun (v1, v2, v3, v4) ->
let v1 = Path.vof_t v1
and v2 = vof_loc Longident.vof_t v2
and v3 = vof_label_description v3
and v4 = vof_expression v4
in Ocaml.VTuple [ v1; v2; v3; v4 ])
v1
and v2 = Ocaml.vof_option vof_expression v2
in Ocaml.VSum (("Texp_record", [ v1; v2 ]))
| Texp_field ((v1, v2, v3, v4)) ->
let v1 = vof_expression v1
and v2 = Path.vof_t v2
and v3 = vof_loc Longident.vof_t v3
and v4 = vof_label_description v4
in Ocaml.VSum (("Texp_field", [ v1; v2; v3; v4 ]))
| Texp_setfield ((v1, v2, v3, v4, v5)) ->
let v1 = vof_expression v1
and v2 = Path.vof_t v2
and v3 = vof_loc Longident.vof_t v3
and v4 = vof_label_description v4
and v5 = vof_expression v5
in Ocaml.VSum (("Texp_setfield", [ v1; v2; v3; v4; v5 ]))
#endif
| Texp_array v1 ->
let v1 = Ocaml.vof_list vof_expression v1
in Ocaml.VSum (("Texp_array", [ v1 ]))
| Texp_ifthenelse ((v1, v2, v3)) ->
let v1 = vof_expression v1
and v2 = vof_expression v2
and v3 = Ocaml.vof_option vof_expression v3
in Ocaml.VSum (("Texp_ifthenelse", [ v1; v2; v3 ]))
| Texp_sequence ((v1, v2)) ->
let v1 = vof_expression v1
and v2 = vof_expression v2
in Ocaml.VSum (("Texp_sequence", [ v1; v2 ]))
| Texp_while ((v1, v2)) ->
let v1 = vof_expression v1
and v2 = vof_expression v2
in Ocaml.VSum (("Texp_while", [ v1; v2 ]))
| Texp_for ((v1, v2, v3, v4, v5, v6)) ->
let v1 = Ident.vof_t v1
and v2 = vof_loc Ocaml.vof_string v2
and v3 = vof_expression v3
and v4 = vof_expression v4
and v5 = vof_direction_flag v5
and v6 = vof_expression v6
in Ocaml.VSum (("Texp_for", [ v1; v2; v3; v4; v5; v6 ]))
| Texp_when ((v1, v2)) ->
let v1 = vof_expression v1
and v2 = vof_expression v2
in Ocaml.VSum (("Texp_when", [ v1; v2 ]))
| Texp_send ((v1, v2, v3)) ->
let v1 = vof_expression v1
and v2 = vof_meth v2
and v3 = Ocaml.vof_option vof_expression v3
in Ocaml.VSum (("Texp_send", [ v1; v2; v3 ]))
| Texp_new ((v1, v2, v3)) ->
let v1 = Path.vof_t v1
and v2 = vof_loc Longident.vof_t v2
and v3 = Types.vof_class_declaration v3
in Ocaml.VSum (("Texp_new", [ v1; v2; v3 ]))
| Texp_instvar ((v1, v2, v3)) ->
let v1 = Path.vof_t v1
and v2 = Path.vof_t v2
and v3 = vof_loc Ocaml.vof_string v3
in Ocaml.VSum (("Texp_instvar", [ v1; v2; v3 ]))
| Texp_setinstvar ((v1, v2, v3, v4)) ->
let v1 = Path.vof_t v1
and v2 = Path.vof_t v2
and v3 = vof_loc Ocaml.vof_string v3
and v4 = vof_expression v4
in Ocaml.VSum (("Texp_setinstvar", [ v1; v2; v3; v4 ]))
| Texp_override ((v1, v2)) ->
let v1 = Path.vof_t v1
and v2 =
Ocaml.vof_list
(fun (v1, v2, v3) ->
let v1 = Path.vof_t v1
and v2 = vof_loc Ocaml.vof_string v2
and v3 = vof_expression v3
in Ocaml.VTuple [ v1; v2; v3 ])
v2
in Ocaml.VSum (("Texp_override", [ v1; v2 ]))
| Texp_letmodule ((v1, v2, v3, v4)) ->
let v1 = Ident.vof_t v1
and v2 = vof_loc Ocaml.vof_string v2
and v3 = vof_module_expr v3
and v4 = vof_expression v4
in Ocaml.VSum (("Texp_letmodule", [ v1; v2; v3; v4 ]))
| Texp_assert v1 ->
let v1 = vof_expression v1 in Ocaml.VSum (("Texp_assert", [ v1 ]))
| Texp_assertfalse -> Ocaml.VSum (("Texp_assertfalse", []))
| Texp_lazy v1 ->
let v1 = vof_expression v1 in Ocaml.VSum (("Texp_lazy", [ v1 ]))
| Texp_object ((v1, v2)) ->
let v1 = vof_class_structure v1
and v2 = Ocaml.vof_list Ocaml.vof_string v2
in Ocaml.VSum (("Texp_object", [ v1; v2 ]))
| Texp_pack v1 ->
let v1 = vof_module_expr v1 in Ocaml.VSum (("Texp_pack", [ v1 ]))
and vof_meth =
function
| Tmeth_name v1 ->
let v1 = Ocaml.vof_string v1 in Ocaml.VSum (("Tmeth_name", [ v1 ]))
| Tmeth_val v1 ->
let v1 = Ident.vof_t v1 in Ocaml.VSum (("Tmeth_val", [ v1 ]))
and
vof_class_expr {
cl_desc = v_cl_desc;
cl_loc = v_cl_loc;
cl_type = v_cl_type;
cl_env = v_cl_env
} =
(*
let bnds = [] in
let arg = Env.vof_t v_cl_env in
let bnd = ("cl_env", arg) in
let bnds = bnd :: bnds in
let arg = Types.vof_class_type v_cl_type in
let bnd = ("cl_type", arg) in
let bnds = bnd :: bnds in
let arg = Location.vof_t v_cl_loc in
let bnd = ("cl_loc", arg) in
let bnds = bnd :: bnds in
let arg = vof_class_expr_desc v_cl_desc in
let bnd = ("cl_desc", arg) in let bnds = bnd :: bnds in Ocaml.VDict bnds
*)
vof_class_expr_desc v_cl_desc
and vof_class_expr_desc =
function
| Tcl_ident ((v1, v2, v3)) ->
let v1 = Path.vof_t v1
and v2 = vof_loc Longident.vof_t v2
and v3 = Ocaml.vof_list vof_core_type v3
in Ocaml.VSum (("Tcl_ident", [ v1; v2; v3 ]))
| Tcl_structure v1 ->
let v1 = vof_class_structure v1
in Ocaml.VSum (("Tcl_structure", [ v1 ]))
| Tcl_fun ((v1, v2, v3, v4, v5)) ->
let v1 = vof_label v1
and v2 = vof_pattern v2
and v3 =
Ocaml.vof_list
(fun (v1, v2, v3) ->
let v1 = Ident.vof_t v1
and v2 = vof_loc Ocaml.vof_string v2
and v3 = vof_expression v3
in Ocaml.VTuple [ v1; v2; v3 ])
v3
and v4 = vof_class_expr v4
and v5 = vof_partial v5
in Ocaml.VSum (("Tcl_fun", [ v1; v2; v3; v4; v5 ]))
| Tcl_apply ((v1, v2)) ->
let v1 = vof_class_expr v1
and v2 =
Ocaml.vof_list
(fun (v1, v2, v3) ->
let v1 = vof_label v1
and v2 = Ocaml.vof_option vof_expression v2
and v3 = vof_optional v3
in Ocaml.VTuple [ v1; v2; v3 ])
v2
in Ocaml.VSum (("Tcl_apply", [ v1; v2 ]))
| Tcl_let ((v1, v2, v3, v4)) ->
let v1 = vof_rec_flag v1
and v2 =
Ocaml.vof_list
(fun (v1, v2) ->
let v1 = vof_pattern v1
and v2 = vof_expression v2
in Ocaml.VTuple [ v1; v2 ])
v2
and v3 =
Ocaml.vof_list
(fun (v1, v2, v3) ->
let v1 = Ident.vof_t v1
and v2 = vof_loc Ocaml.vof_string v2
and v3 = vof_expression v3
in Ocaml.VTuple [ v1; v2; v3 ])
v3
and v4 = vof_class_expr v4
in Ocaml.VSum (("Tcl_let", [ v1; v2; v3; v4 ]))
| Tcl_constraint ((v1, v2, v3, v4, v5)) ->
let v1 = vof_class_expr v1
and v2 = Ocaml.vof_option vof_class_type v2
and v3 = Ocaml.vof_list Ocaml.vof_string v3
and v4 = Ocaml.vof_list Ocaml.vof_string v4
and v5 = Concr.vof_t v5
in Ocaml.VSum (("Tcl_constraint", [ v1; v2; v3; v4; v5 ]))
and
vof_class_structure {
cstr_pat = v_cstr_pat;
cstr_fields = v_cstr_fields;
cstr_type = v_cstr_type;
cstr_meths = v_cstr_meths
} =
let bnds = [] in
let arg = Meths.vof_t Ident.vof_t v_cstr_meths in
let bnd = ("cstr_meths", arg) in
let bnds = bnd :: bnds in
let arg = Types.vof_class_signature v_cstr_type in
let bnd = ("cstr_type", arg) in
let bnds = bnd :: bnds in
let arg = Ocaml.vof_list vof_class_field v_cstr_fields in
let bnd = ("cstr_fields", arg) in
let bnds = bnd :: bnds in
let arg = vof_pattern v_cstr_pat in
let bnd = ("cstr_pat", arg) in let bnds = bnd :: bnds in Ocaml.VDict bnds
and vof_class_field { cf_desc = v_cf_desc; cf_loc = v_cf_loc } =
(*
let bnds = [] in
let arg = Location.vof_t v_cf_loc in
let bnd = ("cf_loc", arg) in
let bnds = bnd :: bnds in
let arg = vof_class_field_desc v_cf_desc in
let bnd = ("cf_desc", arg) in let bnds = bnd :: bnds in Ocaml.VDict bnds
*)
vof_class_field_desc v_cf_desc
and vof_class_field_kind =
function
| Tcfk_virtual v1 ->
let v1 = vof_core_type v1 in Ocaml.VSum (("Tcfk_virtual", [ v1 ]))
| Tcfk_concrete v1 ->
let v1 = vof_expression v1 in Ocaml.VSum (("Tcfk_concrete", [ v1 ]))
and vof_class_field_desc =
function
| Tcf_inher ((v1, v2, v3, v4, v5)) ->
let v1 = vof_override_flag v1
and v2 = vof_class_expr v2
and v3 = Ocaml.vof_option Ocaml.vof_string v3
and v4 =
Ocaml.vof_list
(fun (v1, v2) ->
let v1 = Ocaml.vof_string v1
and v2 = Ident.vof_t v2
in Ocaml.VTuple [ v1; v2 ])
v4
and v5 =
Ocaml.vof_list
(fun (v1, v2) ->
let v1 = Ocaml.vof_string v1
and v2 = Ident.vof_t v2
in Ocaml.VTuple [ v1; v2 ])
v5
in Ocaml.VSum (("Tcf_inher", [ v1; v2; v3; v4; v5 ]))
| Tcf_val ((v1, v2, v3, v4, v5, v6)) ->
let v1 = Ocaml.vof_string v1
and v2 = vof_loc Ocaml.vof_string v2
and v3 = vof_mutable_flag v3
and v4 = Ident.vof_t v4
and v5 = vof_class_field_kind v5
and v6 = Ocaml.vof_bool v6
in Ocaml.VSum (("Tcf_val", [ v1; v2; v3; v4; v5; v6 ]))
| Tcf_meth ((v1, v2, v3, v4, v5)) ->
let v1 = Ocaml.vof_string v1
and v2 = vof_loc Ocaml.vof_string v2
and v3 = vof_private_flag v3
and v4 = vof_class_field_kind v4
and v5 = Ocaml.vof_bool v5
in Ocaml.VSum (("Tcf_meth", [ v1; v2; v3; v4; v5 ]))
| Tcf_constr ((v1, v2)) ->
let v1 = vof_core_type v1
and v2 = vof_core_type v2
in Ocaml.VSum (("Tcf_constr", [ v1; v2 ]))
| Tcf_init v1 ->
let v1 = vof_expression v1 in Ocaml.VSum (("Tcf_init", [ v1 ]))
and
vof_module_expr {
mod_desc = v_mod_desc;
mod_loc = v_mod_loc;
mod_type = v_mod_type;
mod_env = v_mod_env
} =
(*
let bnds = [] in
let arg = Env.vof_t v_mod_env in
let bnd = ("mod_env", arg) in
let bnds = bnd :: bnds in
let arg = Types.vof_module_type v_mod_type in
let bnd = ("mod_type", arg) in
let bnds = bnd :: bnds in
let arg = Location.vof_t v_mod_loc in
let bnd = ("mod_loc", arg) in
let bnds = bnd :: bnds in
let arg = vof_module_expr_desc v_mod_desc in
let bnd = ("mod_desc", arg) in let bnds = bnd :: bnds in Ocaml.VDict bnds
*)
vof_module_expr_desc v_mod_desc
and vof_module_type_constraint =
function
| Tmodtype_implicit -> Ocaml.VSum (("Tmodtype_implicit", []))
| Tmodtype_explicit v1 ->
let v1 = vof_module_type v1
in Ocaml.VSum (("Tmodtype_explicit", [ v1 ]))
and vof_module_expr_desc =
function
| Tmod_ident ((v1, v2)) ->
let v1 = Path.vof_t v1
and v2 = vof_loc Longident.vof_t v2
in Ocaml.VSum (("Tmod_ident", [ v1; v2 ]))
| Tmod_structure v1 ->
let v1 = vof_structure v1 in Ocaml.VSum (("Tmod_structure", [ v1 ]))
| Tmod_functor ((v1, v2, v3, v4)) ->
let v1 = Ident.vof_t v1
and v2 = vof_loc Ocaml.vof_string v2
and v3 = vof_module_type v3
and v4 = vof_module_expr v4
in Ocaml.VSum (("Tmod_functor", [ v1; v2; v3; v4 ]))
| Tmod_apply ((v1, v2, v3)) ->
let v1 = vof_module_expr v1
and v2 = vof_module_expr v2
and v3 = vof_module_coercion v3
in Ocaml.VSum (("Tmod_apply", [ v1; v2; v3 ]))
| Tmod_constraint ((v1, v2, v3, v4)) ->
let v1 = vof_module_expr v1
and v2 = Types.vof_module_type v2
and v3 = vof_module_type_constraint v3
and v4 = vof_module_coercion v4
in Ocaml.VSum (("Tmod_constraint", [ v1; v2; v3; v4 ]))
| Tmod_unpack ((v1, v2)) ->
let v1 = vof_expression v1
and v2 = Types.vof_module_type v2
in Ocaml.VSum (("Tmod_unpack", [ v1; v2 ]))
and
vof_structure {
str_items = v_str_items;
str_type = v_str_type;
str_final_env = v_str_final_env
} =
let bnds = [] in
let arg = Env.vof_t v_str_final_env in
let bnd = ("str_final_env", arg) in
let bnds = bnd :: bnds in
let arg = Types.vof_signature v_str_type in
let bnd = ("str_type", arg) in
let bnds = bnd :: bnds in
let arg = Ocaml.vof_list vof_structure_item v_str_items in
let bnd = ("str_items", arg) in let bnds = bnd :: bnds in Ocaml.VDict bnds
and
vof_structure_item {
str_desc = v_str_desc;
str_loc = v_str_loc;
str_env = v_str_env
} =
(*
let bnds = [] in
let arg = Env.vof_t v_str_env in
let bnd = ("str_env", arg) in
let bnds = bnd :: bnds in
let arg = Location.vof_t v_str_loc in
let bnd = ("str_loc", arg) in
let bnds = bnd :: bnds in
let arg = vof_structure_item_desc v_str_desc in
let bnd = ("str_desc", arg) in
let bnds = bnd :: bnds in
Ocaml.VDict bnds
*)
vof_structure_item_desc v_str_desc
and vof_structure_item_desc =
function
| Tstr_eval v1 ->
let v1 = vof_expression v1 in Ocaml.VSum (("Tstr_eval", [ v1 ]))
| Tstr_value ((v1, v2)) ->
let v1 = vof_rec_flag v1
and v2 =
Ocaml.vof_list
(fun (v1, v2) ->
let v1 = vof_pattern v1
and v2 = vof_expression v2
in Ocaml.VTuple [ v1; v2 ])
v2
in Ocaml.VSum (("Tstr_value", [ v1; v2 ]))
| Tstr_primitive ((v1, v2, v3)) ->
let v1 = Ident.vof_t v1
and v2 = vof_loc Ocaml.vof_string v2
and v3 = vof_value_description v3
in Ocaml.VSum (("Tstr_primitive", [ v1; v2; v3 ]))
| Tstr_type v1 ->
let v1 =
Ocaml.vof_list
(fun (v1, v2, v3) ->
let v1 = Ident.vof_t v1
and v2 = vof_loc Ocaml.vof_string v2
and v3 = vof_type_declaration v3
in Ocaml.VTuple [ v1; v2; v3 ])
v1
in Ocaml.VSum (("Tstr_type", [ v1 ]))
| Tstr_exception ((v1, v2, v3)) ->
let v1 = Ident.vof_t v1
and v2 = vof_loc Ocaml.vof_string v2
and v3 = vof_exception_declaration v3
in Ocaml.VSum (("Tstr_exception", [ v1; v2; v3 ]))
| Tstr_exn_rebind ((v1, v2, v3, v4)) ->
let v1 = Ident.vof_t v1
and v2 = vof_loc Ocaml.vof_string v2
and v3 = Path.vof_t v3
and v4 = vof_loc Longident.vof_t v4
in Ocaml.VSum (("Tstr_exn_rebind", [ v1; v2; v3; v4 ]))
| Tstr_module ((v1, v2, v3)) ->
let v1 = Ident.vof_t v1
and v2 = vof_loc Ocaml.vof_string v2
and v3 = vof_module_expr v3
in Ocaml.VSum (("Tstr_module", [ v1; v2; v3 ]))
| Tstr_recmodule v1 ->
let v1 =
Ocaml.vof_list
(fun (v1, v2, v3, v4) ->
let v1 = Ident.vof_t v1
and v2 = vof_loc Ocaml.vof_string v2
and v3 = vof_module_type v3
and v4 = vof_module_expr v4
in Ocaml.VTuple [ v1; v2; v3; v4 ])
v1
in Ocaml.VSum (("Tstr_recmodule", [ v1 ]))
| Tstr_modtype ((v1, v2, v3)) ->
let v1 = Ident.vof_t v1
and v2 = vof_loc Ocaml.vof_string v2
and v3 = vof_module_type v3
in Ocaml.VSum (("Tstr_modtype", [ v1; v2; v3 ]))
#if OCAML_VERSION >= 4010
| Tstr_open ((v1, v2, v3)) ->
let v1 = vof_override_flag v1
and v2 = Path.vof_t v2
and v3 = vof_loc Longident.vof_t v3
in Ocaml.VSum (("Tstr_open", [ v1; v2; v3 ]))
#else
| Tstr_open ((v1, v2)) ->
let v1 = Path.vof_t v1
and v2 = vof_loc Longident.vof_t v2
in Ocaml.VSum (("Tstr_open", [ v1; v2 ]))
#endif
| Tstr_class v1 ->
let v1 =
Ocaml.vof_list
(fun (v1, v2, v3) ->
let v1 = vof_class_declaration v1
and v2 = Ocaml.vof_list Ocaml.vof_string v2
and v3 = vof_virtual_flag v3
in Ocaml.VTuple [ v1; v2; v3 ])
v1
in Ocaml.VSum (("Tstr_class", [ v1 ]))
| Tstr_class_type v1 ->
let v1 =
Ocaml.vof_list
(fun (v1, v2, v3) ->
let v1 = Ident.vof_t v1
and v2 = vof_loc Ocaml.vof_string v2
and v3 = vof_class_type_declaration v3
in Ocaml.VTuple [ v1; v2; v3 ])
v1
in Ocaml.VSum (("Tstr_class_type", [ v1 ]))
#if OCAML_VERSION >= 4010
| Tstr_include ((v1, v2)) ->
let v1 = vof_module_expr v1
and v2 = Types.vof_signature v2
in Ocaml.VSum (("Tstr_include", [ v1; v2 ]))
#else
| Tstr_include ((v1, v2)) ->
let v1 = vof_module_expr v1
and v2 = Ocaml.vof_list Ident.vof_t v2
in Ocaml.VSum (("Tstr_include", [ v1; v2 ]))
#endif
and vof_module_coercion =
function
| Tcoerce_none -> Ocaml.VSum (("Tcoerce_none", []))
| Tcoerce_structure v1 ->
let v1 =
Ocaml.vof_list
(fun (v1, v2) ->
let v1 = Ocaml.vof_int v1
and v2 = vof_module_coercion v2
in Ocaml.VTuple [ v1; v2 ])
v1
in Ocaml.VSum (("Tcoerce_structure", [ v1 ]))
| Tcoerce_functor ((v1, v2)) ->
let v1 = vof_module_coercion v1
and v2 = vof_module_coercion v2
in Ocaml.VSum (("Tcoerce_functor", [ v1; v2 ]))
| Tcoerce_primitive v1 ->
let v1 = Primitive.vof_description v1
in Ocaml.VSum (("Tcoerce_primitive", [ v1 ]))
and
vof_module_type {
mty_desc = v_mty_desc;
mty_type = v_mty_type;