aboutsummaryrefslogtreecommitdiff
path: root/src/comp/front/ast.rs
diff options
context:
space:
mode:
authorPatrick Walton <[email protected]>2011-03-17 17:39:47 -0700
committerPatrick Walton <[email protected]>2011-03-17 17:39:47 -0700
commit5eca7129e3857e3506d12de7591238f8a7d55da1 (patch)
tree54701099b4b723539074b662daaf3290e63d51e0 /src/comp/front/ast.rs
parentrustc: Typo: mutabliity -> mutability (diff)
downloadrust-5eca7129e3857e3506d12de7591238f8a7d55da1.tar.xz
rust-5eca7129e3857e3506d12de7591238f8a7d55da1.zip
rustc: Switch mutability from being a type constructor to a field annotation
Diffstat (limited to 'src/comp/front/ast.rs')
-rw-r--r--src/comp/front/ast.rs14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/comp/front/ast.rs b/src/comp/front/ast.rs
index 1970f788..e519d03b 100644
--- a/src/comp/front/ast.rs
+++ b/src/comp/front/ast.rs
@@ -168,7 +168,6 @@ tag unop {
bitnot;
not;
neg;
- _mutable;
}
fn unop_to_str(unop op) -> str {
@@ -178,7 +177,6 @@ fn unop_to_str(unop op) -> str {
case (bitnot) {ret "~";}
case (not) {ret "!";}
case (neg) {ret "-";}
- case (_mutable) {ret "mutable";}
}
}
@@ -215,7 +213,7 @@ type field = rec(mutability mut, ident ident, @expr expr);
type expr = spanned[expr_];
tag expr_ {
- expr_vec(vec[@expr], ann);
+ expr_vec(vec[@expr], mutability, ann);
expr_tup(vec[elt], ann);
expr_rec(vec[field], option.t[@expr], ann);
expr_call(@expr, vec[@expr], ann);
@@ -263,7 +261,8 @@ tag lit_ {
// NB: If you change this, you'll probably want to change the corresponding
// type structure in middle/ty.rs as well.
-type ty_field = rec(ident ident, @ty ty);
+type mt = rec(@ty ty, mutability mut);
+type ty_field = rec(ident ident, mt mt);
type ty_arg = rec(mode mode, @ty ty);
// TODO: effect
type ty_method = rec(proto proto, ident ident,
@@ -277,16 +276,15 @@ tag ty_ {
ty_machine(util.common.ty_mach);
ty_char;
ty_str;
- ty_box(@ty);
- ty_vec(@ty);
+ ty_box(mt);
+ ty_vec(mt);
ty_port(@ty);
ty_chan(@ty);
- ty_tup(vec[@ty]);
+ ty_tup(vec[mt]);
ty_rec(vec[ty_field]);
ty_fn(proto, vec[ty_arg], @ty); // TODO: effect
ty_obj(vec[ty_method]);
ty_path(path, option.t[def]);
- ty_mutable(@ty);
ty_type;
ty_constr(@ty, vec[@constr]);
}