Skip to content

Commit 459e860

Browse files
tohavagraydon
authored andcommitted
Added forgotten handling for alt_type_else, and also for stmt_note
1 parent 122ea68 commit 459e860

File tree

1 file changed

+26
-10
lines changed

1 file changed

+26
-10
lines changed

src/boot/fe/ast.ml

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,14 @@ and stmt_alt_type =
254254
{
255255
alt_type_lval: lval;
256256
alt_type_arms: type_arm array;
257-
alt_type_else: stmt option;
257+
alt_type_else: block option;
258+
}
259+
260+
and stmt_alt_port =
261+
{
262+
(* else lval is a timeout value. *)
263+
alt_port_arms: (lval * lval) array;
264+
alt_port_else: (lval * block) option;
258265
}
259266

260267
and block' = stmt array
@@ -264,12 +271,6 @@ and stmt_decl =
264271
DECL_mod_item of (ident * mod_item)
265272
| DECL_slot of (slot_key * (slot identified))
266273

267-
and stmt_alt_port =
268-
{
269-
(* else lval is a timeout value. *)
270-
alt_port_arms: (lval * lval) array;
271-
alt_port_else: (lval * stmt) option;
272-
}
273274

274275
and stmt_while =
275276
{
@@ -1233,10 +1234,25 @@ and fmt_stmt_body (ff:Format.formatter) (s:stmt) : unit =
12331234
fmt ff ") ";
12341235
fmt_obr ff;
12351236
Array.iter (fmt_type_arm ff) at.alt_type_arms;
1237+
begin
1238+
match at.alt_type_else with
1239+
None -> ()
1240+
| Some block ->
1241+
fmt ff "@\n";
1242+
fmt_obox ff;
1243+
fmt ff "case (_) ";
1244+
fmt_obr ff;
1245+
fmt_stmts ff block.node;
1246+
fmt_cbb ff;
1247+
end;
12361248
fmt_cbb ff;
1237-
12381249
| STMT_alt_port _ -> fmt ff "?stmt_alt_port?"
1239-
| STMT_note _ -> fmt ff "?stmt_note?"
1250+
| STMT_note at ->
1251+
begin
1252+
fmt ff "note ";
1253+
fmt_atom ff at;
1254+
fmt ff ";"
1255+
end
12401256
| STMT_slice (dst, src, slice) ->
12411257
fmt_lval ff dst;
12421258
fmt ff " = ";
@@ -1245,7 +1261,7 @@ and fmt_stmt_body (ff:Format.formatter) (s:stmt) : unit =
12451261
fmt_slice ff slice;
12461262
fmt ff ";";
12471263
end
1248-
1264+
12491265
and fmt_arm
12501266
(ff:Format.formatter)
12511267
(fmt_arm_case_expr : Format.formatter -> unit)

0 commit comments

Comments
 (0)