aboutsummaryrefslogtreecommitdiff
path: root/src/boot/fe
diff options
context:
space:
mode:
authorOr Brostovski <[email protected]>2010-08-06 16:11:15 +0300
committerGraydon Hoare <[email protected]>2010-08-06 17:34:31 -0700
commit122ea68b12ec1587f0fe0bd4737ae866e2a56c39 (patch)
treef2437f1a8de9391a0aec9fe679dc98b9d87b9775 /src/boot/fe
parentAdded AST logging, and modified AST for consistent handling of alt stmts. (diff)
downloadrust-122ea68b12ec1587f0fe0bd4737ae866e2a56c39.tar.xz
rust-122ea68b12ec1587f0fe0bd4737ae866e2a56c39.zip
Added AST pretty printing for slice expression
Diffstat (limited to 'src/boot/fe')
-rw-r--r--src/boot/fe/ast.ml29
1 files changed, 28 insertions, 1 deletions
diff --git a/src/boot/fe/ast.ml b/src/boot/fe/ast.ml
index d4ace045..9cad5ce5 100644
--- a/src/boot/fe/ast.ml
+++ b/src/boot/fe/ast.ml
@@ -1237,7 +1237,13 @@ and fmt_stmt_body (ff:Format.formatter) (s:stmt) : unit =
| STMT_alt_port _ -> fmt ff "?stmt_alt_port?"
| STMT_note _ -> fmt ff "?stmt_note?"
- | STMT_slice _ -> fmt ff "?stmt_slice?"
+ | STMT_slice (dst, src, slice) ->
+ fmt_lval ff dst;
+ fmt ff " = ";
+ fmt_lval ff src;
+ fmt ff ".";
+ fmt_slice ff slice;
+ fmt ff ";";
end
and fmt_arm
@@ -1275,6 +1281,27 @@ and fmt_pat (ff:Format.formatter) (pat:pat) : unit =
| PAT_wild ->
fmt ff "_"
+and fmt_slice (ff:Format.formatter) (slice:slice) : unit =
+ let fmt_slice_start = (match slice.slice_start with
+ None -> (fun ff -> fmt ff "0")
+ | Some atom -> (fun ff -> fmt_atom ff atom)) in
+ fmt ff "(@[";
+ fmt_slice_start ff;
+ begin
+ match slice.slice_len with
+ None -> fmt ff ","
+ | Some slice_len ->
+ fmt ff ",@ @[";
+ fmt_slice_start ff;
+ fmt ff " +@ ";
+ fmt_atom ff slice_len;
+ fmt ff "@]";
+ end;
+ fmt ff "@])";
+
+
+
+
and fmt_decl_param (ff:Format.formatter) (param:ty_param) : unit =
let (ident, (i, e)) = param in
fmt_effect ff e;