aboutsummaryrefslogtreecommitdiff
path: root/src/comp/pretty
diff options
context:
space:
mode:
authorMarijn Haverbeke <[email protected]>2011-03-28 20:46:31 +0200
committerGraydon Hoare <[email protected]>2011-03-31 14:41:40 +0000
commitf8393cc572db5a18b9412324a7501fadb48f9944 (patch)
tree9ed9d5ce650bc6685b26b7ecec0be14589fd3515 /src/comp/pretty
parentPreserve comments when pretty-printing. (diff)
downloadrust-f8393cc572db5a18b9412324a7501fadb48f9944.tar.xz
rust-f8393cc572db5a18b9412324a7501fadb48f9944.zip
Add effect field to ast.ty_fn.
Still not used, except by the pretty-printer.
Diffstat (limited to 'src/comp/pretty')
-rw-r--r--src/comp/pretty/pprust.rs13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/comp/pretty/pprust.rs b/src/comp/pretty/pprust.rs
index ac5cec31..e7e2746c 100644
--- a/src/comp/pretty/pprust.rs
+++ b/src/comp/pretty/pprust.rs
@@ -127,7 +127,7 @@ impure fn print_type(ps s, &@ast.ty ty) {
bopen(s);
for (ast.ty_method m in methods) {
hbox(s);
- print_ty_fn(s, m.proto, option.some[str](m.ident),
+ print_ty_fn(s, m.effect, m.proto, option.some[str](m.ident),
m.inputs, m.output);
wrd(s.s, ";");
end(s.s);
@@ -135,8 +135,8 @@ impure fn print_type(ps s, &@ast.ty ty) {
}
bclose_c(s, ty.span);
}
- case (ast.ty_fn(?proto,?inputs,?output)) {
- print_ty_fn(s, proto, option.none[str], inputs, output);
+ case (ast.ty_fn(?eff, ?proto,?inputs,?output)) {
+ print_ty_fn(s, eff, proto, option.none[str], inputs, output);
}
case (ast.ty_path(?path,_)) {
print_path(s, path);
@@ -843,8 +843,13 @@ impure fn print_string(ps s, str st) {
wrd(s.s, "\""); wrd(s.s, escape_str(st, '"')); wrd(s.s, "\"");
}
-impure fn print_ty_fn(ps s, ast.proto proto, option.t[str] id,
+impure fn print_ty_fn(ps s, ast.effect eff, ast.proto proto, option.t[str] id,
vec[ast.ty_arg] inputs, @ast.ty output) {
+ alt (eff) {
+ case (ast.eff_impure) {wrd1(s, "impure");}
+ case (ast.eff_unsafe) {wrd1(s, "unsafe");}
+ case (_) {}
+ }
if (proto == ast.proto_fn) {wrd(s.s, "fn");}
else {wrd(s.s, "iter");}
alt (id) {