Skip to content

Commit

Permalink
Added forgotten handling for alt_type_else, and also for stmt_note
Browse files Browse the repository at this point in the history
  • Loading branch information
Tohava committed Aug 6, 2010
1 parent 4bc173f commit 7d38caf
Showing 1 changed file with 26 additions and 10 deletions.
36 changes: 26 additions & 10 deletions src/boot/fe/ast.ml
Expand Up @@ -254,7 +254,14 @@ and stmt_alt_type =
{
alt_type_lval: lval;
alt_type_arms: type_arm array;
alt_type_else: stmt option;
alt_type_else: block option;
}

and stmt_alt_port =
{
(* else lval is a timeout value. *)
alt_port_arms: (lval * lval) array;
alt_port_else: (lval * block) option;
}

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

and stmt_alt_port =
{
(* else lval is a timeout value. *)
alt_port_arms: (lval * lval) array;
alt_port_else: (lval * stmt) option;
}

and stmt_while =
{
Expand Down Expand Up @@ -1233,10 +1234,25 @@ and fmt_stmt_body (ff:Format.formatter) (s:stmt) : unit =
fmt ff ") ";
fmt_obr ff;
Array.iter (fmt_type_arm ff) at.alt_type_arms;
begin
match at.alt_type_else with
None -> ()
| Some block ->
fmt ff "@\n";
fmt_obox ff;
fmt ff "case (_) ";
fmt_obr ff;
fmt_stmts ff block.node;
fmt_cbb ff;
end;
fmt_cbb ff;

| STMT_alt_port _ -> fmt ff "?stmt_alt_port?"
| STMT_note _ -> fmt ff "?stmt_note?"
| STMT_note at ->
begin
fmt ff "note ";
fmt_atom ff at;
fmt ff ";"
end
| STMT_slice (dst, src, slice) ->
fmt_lval ff dst;
fmt ff " = ";
Expand All @@ -1245,7 +1261,7 @@ and fmt_stmt_body (ff:Format.formatter) (s:stmt) : unit =
fmt_slice ff slice;
fmt ff ";";
end

and fmt_arm
(ff:Format.formatter)
(fmt_arm_case_expr : Format.formatter -> unit)
Expand Down

0 comments on commit 7d38caf

Please sign in to comment.