diff options
| author | Patrick Walton <[email protected]> | 2011-03-21 11:44:08 -0700 |
|---|---|---|
| committer | Patrick Walton <[email protected]> | 2011-03-21 11:44:08 -0700 |
| commit | 84c0d8638ebf766cc4f6e442bbd4f01c5810795a (patch) | |
| tree | 916d6c4b84efd58682e323e773f782117fcff628 /src/comp/front/creader.rs | |
| parent | rustc: Merge in type serialization and deserialization (diff) | |
| download | rust-84c0d8638ebf766cc4f6e442bbd4f01c5810795a.tar.xz rust-84c0d8638ebf766cc4f6e442bbd4f01c5810795a.zip | |
rustc: Update type serialization and deserialization for the "mutable?" change
Diffstat (limited to 'src/comp/front/creader.rs')
| -rw-r--r-- | src/comp/front/creader.rs | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/comp/front/creader.rs b/src/comp/front/creader.rs index 89a19fc2..8ef75e54 100644 --- a/src/comp/front/creader.rs +++ b/src/comp/front/creader.rs @@ -59,6 +59,16 @@ impure fn parse_ty(@pstate st, str_def sd) -> @ty.t { cname=option.none[str]); } +impure fn parse_mt(@pstate st, str_def sd) -> ty.mt { + auto mut; + alt (peek(st)) { + case ('m') {next(st); mut = ast.mut;} + case ('?') {next(st); mut = ast.maybe_mut;} + case (_) {mut=ast.imm;} + } + ret rec(ty=parse_ty(st, sd), mut=mut); +} + impure fn parse_sty(@pstate st, str_def sd) -> ty.sty { alt (next(st)) { case ('n') {ret ty.ty_nil;} @@ -93,15 +103,15 @@ impure fn parse_sty(@pstate st, str_def sd) -> ty.sty { st.pos = st.pos + 1u; ret ty.ty_tag(sd(def), params); } - case ('@') {ret ty.ty_box(parse_ty(st, sd));} - case ('V') {ret ty.ty_vec(parse_ty(st, sd));} + case ('@') {ret ty.ty_box(parse_mt(st, sd));} + case ('V') {ret ty.ty_vec(parse_mt(st, sd));} case ('P') {ret ty.ty_port(parse_ty(st, sd));} case ('C') {ret ty.ty_chan(parse_ty(st, sd));} case ('T') { check(next(st) == '['); - let vec[@ty.t] params = vec(); + let vec[ty.mt] params = vec(); while (peek(st) != ']') { - params = _vec.push[@ty.t](params, parse_ty(st, sd)); + params = _vec.push[ty.mt](params, parse_mt(st, sd)); } st.pos = st.pos + 1u; ret ty.ty_tup(params); @@ -114,7 +124,7 @@ impure fn parse_sty(@pstate st, str_def sd) -> ty.sty { while (peek(st) != '=') {name += _str.from_char(next(st));} st.pos = st.pos + 1u; fields = _vec.push[ty.field] - (fields, rec(ident=name, ty=parse_ty(st, sd))); + (fields, rec(ident=name, mt=parse_mt(st, sd))); } st.pos = st.pos + 1u; ret ty.ty_rec(fields); |