diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2013-04-24 01:29:46 -0700 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2013-04-29 14:30:55 -0700 |
| commit | f30f54e9d062bdb5b3cb10dd7185470280c1c278 (patch) | |
| tree | b641e10eb9ee445b023d9d9b69ea8330c41ca30b /src/librustc/middle/astencode.rs | |
| parent | a12a3db5b44d539f5512376a2e7bb40fbab63683 (diff) | |
| download | rust-f30f54e9d062bdb5b3cb10dd7185470280c1c278.tar.gz rust-f30f54e9d062bdb5b3cb10dd7185470280c1c278.zip | |
librustc: Remove the concept of modes from the compiler.
This commit does not remove `ty::arg`, although that should be possible to do now.
Diffstat (limited to 'src/librustc/middle/astencode.rs')
| -rw-r--r-- | src/librustc/middle/astencode.rs | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/librustc/middle/astencode.rs b/src/librustc/middle/astencode.rs index f1fd1cd7242..c7c9c110586 100644 --- a/src/librustc/middle/astencode.rs +++ b/src/librustc/middle/astencode.rs @@ -410,7 +410,7 @@ impl tr for ast::def { ast::def_mod(did) => { ast::def_mod(did.tr(xcx)) } ast::def_foreign_mod(did) => { ast::def_foreign_mod(did.tr(xcx)) } ast::def_const(did) => { ast::def_const(did.tr(xcx)) } - ast::def_arg(nid, m, b) => { ast::def_arg(xcx.tr_id(nid), m, b) } + ast::def_arg(nid, b) => { ast::def_arg(xcx.tr_id(nid), b) } ast::def_local(nid, b) => { ast::def_local(xcx.tr_id(nid), b) } ast::def_variant(e_did, v_did) => { ast::def_variant(e_did.tr(xcx), v_did.tr(xcx)) @@ -571,6 +571,9 @@ fn encode_method_map_entry(ecx: @e::EncodeContext, do ebml_w.emit_field(~"origin", 1u) { mme.origin.encode(ebml_w); } + do ebml_w.emit_field(~"self_mode", 3) { + mme.self_mode.encode(ebml_w); + } } } @@ -590,6 +593,9 @@ fn encode_method_map_entry(ecx: @e::EncodeContext, do ebml_w.emit_struct_field("origin", 1u) { mme.origin.encode(ebml_w); } + do ebml_w.emit_struct_field("self_mode", 3) { + mme.self_mode.encode(ebml_w); + } } } @@ -611,6 +617,10 @@ impl read_method_map_entry_helper for reader::Decoder { Decodable::decode(self); method_origin.tr(xcx) }), + self_mode: self.read_field(~"self_mode", 3, || { + let self_mode: ty::SelfMode = Decodable::decode(self); + self_mode + }), } } } @@ -625,7 +635,7 @@ impl read_method_map_entry_helper for reader::Decoder { self_arg: self.read_struct_field("self_arg", 0u, || { self.read_arg(xcx) }), - explicit_self: self.read_struct_field("explicit_self", 2u, || { + explicit_self: self.read_struct_field("explicit_self", 2, || { let self_type: ast::self_ty_ = Decodable::decode(self); self_type }), @@ -634,6 +644,10 @@ impl read_method_map_entry_helper for reader::Decoder { Decodable::decode(self); method_origin.tr(xcx) }), + self_mode: self.read_struct_field("self_mode", 3, || { + let self_mode: ty::SelfMode = Decodable::decode(self); + self_mode + }), } } } @@ -978,20 +992,6 @@ fn encode_side_tables_for_id(ecx: @e::EncodeContext, } } - // I believe it is not necessary to encode this information. The - // ids will appear in the AST but in the *type* information, which - // is what we actually use in trans, all modes will have been - // resolved. - // - //for tcx.inferred_modes.find(&id).each |m| { - // ebml_w.tag(c::tag_table_inferred_modes) {|| - // ebml_w.id(id); - // ebml_w.tag(c::tag_table_val) {|| - // tyencode::enc_mode(ebml_w.writer, ty_str_ctxt(), m); - // } - // } - //} - if maps.mutbl_map.contains(&id) { do ebml_w.tag(c::tag_table_mutbl) { ebml_w.id(id); |
