@@ -247,13 +247,13 @@ and stmt = stmt' identified
247
247
and stmt_alt_tag =
248
248
{
249
249
alt_tag_lval : lval ;
250
- alt_tag_arms : arm array ;
250
+ alt_tag_arms : tag_arm array ;
251
251
}
252
252
253
253
and stmt_alt_type =
254
254
{
255
255
alt_type_lval : lval ;
256
- alt_type_arms : ( ident * slot * stmt ) array ;
256
+ alt_type_arms : type_arm array ;
257
257
alt_type_else : stmt option ;
258
258
}
259
259
@@ -318,8 +318,11 @@ and pat =
318
318
| PAT_slot of ((slot identified) * ident)
319
319
| PAT_wild
320
320
321
- and arm' = pat * block
322
- and arm = arm' identified
321
+ and tag_arm' = pat * block
322
+ and tag_arm = tag_arm' identified
323
+
324
+ and type_arm' = ident * slot * block
325
+ and type_arm = type_arm' identified
323
326
324
327
and atom =
325
328
ATOM_literal of (lit identified)
@@ -646,6 +649,16 @@ and fmt_iso (ff:Format.formatter) (tiso:ty_iso) : unit =
646
649
done ;
647
650
fmt ff " @]]@]"
648
651
652
+ and fmt_constrained ff (ty , constrs ) : unit =
653
+ fmt ff " @[" ;
654
+ fmt_ty ff ty;
655
+ fmt ff " : " ;
656
+ fmt ff " @[" ;
657
+ fmt_constrs ff constrs;
658
+ fmt ff " @]" ;
659
+ fmt ff " @]" ;
660
+
661
+
649
662
and fmt_ty (ff :Format.formatter ) (t :ty ) : unit =
650
663
match t with
651
664
TY_any -> fmt ff " any"
@@ -687,7 +700,7 @@ and fmt_ty (ff:Format.formatter) (t:ty) : unit =
687
700
| TY_tag ttag -> fmt_tag ff ttag
688
701
| TY_iso tiso -> fmt_iso ff tiso
689
702
| TY_idx idx -> fmt ff " <idx#%d>" idx
690
- | TY_constrained _ -> fmt ff " ?constrained? "
703
+ | TY_constrained ctrd -> fmt_constrained ff ctrd
691
704
692
705
| TY_obj (effect , fns ) ->
693
706
fmt_obox ff;
@@ -707,7 +720,13 @@ and fmt_ty (ff:Format.formatter) (t:ty) : unit =
707
720
708
721
709
722
and fmt_constrs (ff :Format.formatter ) (cc :constr array ) : unit =
710
- Array. iter (fmt_constr ff) cc
723
+ for i = 0 to (Array. length cc) - 1
724
+ do
725
+ if i != 0
726
+ then fmt ff " ,@ " ;
727
+ fmt_constr ff cc.(i)
728
+ done ;
729
+ (* Array.iter (fmt_constr ff) cc *)
711
730
712
731
and fmt_decl_constrs (ff :Format.formatter ) (cc :constr array ) : unit =
713
732
if Array. length cc = 0
@@ -1204,25 +1223,45 @@ and fmt_stmt_body (ff:Format.formatter) (s:stmt) : unit =
1204
1223
fmt_lval ff at.alt_tag_lval;
1205
1224
fmt ff " ) " ;
1206
1225
fmt_obr ff;
1207
- Array. iter (fmt_arm ff) at.alt_tag_arms;
1226
+ Array. iter (fmt_tag_arm ff) at.alt_tag_arms;
1208
1227
fmt_cbb ff;
1209
1228
1210
- | STMT_alt_type _ -> fmt ff " ?stmt_alt_type?"
1229
+ | STMT_alt_type at ->
1230
+ fmt_obox ff;
1231
+ fmt ff " alt type (" ;
1232
+ fmt_lval ff at.alt_type_lval;
1233
+ fmt ff " ) " ;
1234
+ fmt_obr ff;
1235
+ Array. iter (fmt_type_arm ff) at.alt_type_arms;
1236
+ fmt_cbb ff;
1237
+
1211
1238
| STMT_alt_port _ -> fmt ff " ?stmt_alt_port?"
1212
1239
| STMT_note _ -> fmt ff " ?stmt_note?"
1213
1240
| STMT_slice _ -> fmt ff " ?stmt_slice?"
1214
1241
end
1215
1242
1216
- and fmt_arm (ff :Format.formatter ) (arm :arm ) : unit =
1217
- let (pat, block) = arm.node in
1218
- fmt ff " @\n " ;
1219
- fmt_obox ff;
1220
- fmt ff " case (" ;
1221
- fmt_pat ff pat;
1222
- fmt ff " ) " ;
1223
- fmt_obr ff;
1224
- fmt_stmts ff block.node;
1225
- fmt_cbb ff;
1243
+ and fmt_arm
1244
+ (ff :Format.formatter )
1245
+ (fmt_arm_case_expr : Format.formatter -> unit )
1246
+ (block : block )
1247
+ : unit =
1248
+ fmt ff " @\n " ;
1249
+ fmt_obox ff;
1250
+ fmt ff " case (" ;
1251
+ fmt_arm_case_expr ff;
1252
+ fmt ff " ) " ;
1253
+ fmt_obr ff;
1254
+ fmt_stmts ff block.node;
1255
+ fmt_cbb ff;
1256
+
1257
+ and fmt_tag_arm (ff :Format.formatter ) (tag_arm :tag_arm ) : unit =
1258
+ let (pat, block) = tag_arm.node in
1259
+ fmt_arm ff (fun ff -> fmt_pat ff pat) block;
1260
+
1261
+ and fmt_type_arm (ff :Format.formatter ) (type_arm :type_arm ) : unit =
1262
+ let (_, slot, block) = type_arm.node in
1263
+ fmt_arm ff (fun ff -> fmt_slot ff slot) block;
1264
+
1226
1265
1227
1266
and fmt_pat (ff :Format.formatter ) (pat :pat ) : unit =
1228
1267
match pat with
0 commit comments