Skip to content

Commit 2029c92

Browse files
committed
---
yaml --- r: 61326 b: refs/heads/try c: 8d19f44 h: refs/heads/master v: v3
1 parent 9905b40 commit 2029c92

File tree

3 files changed

+102
-1
lines changed

3 files changed

+102
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 2d28d645422c1617be58c8ca7ad9a457264ca850
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 2d28d645422c1617be58c8ca7ad9a457264ca850
5-
refs/heads/try: 4bfe0f717f51eaf7c00f686d6dbd68607b585535
5+
refs/heads/try: 8d19f44c9dbe780cbed3ee44d7a7684e178a8832
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/src/libsyntax/ast.rs

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ use opt_vec::OptVec;
1717
use core::cast;
1818
use core::option::{None, Option, Some};
1919
use core::to_bytes;
20+
use core::to_bytes::IterBytes;
2021
use core::to_str::ToStr;
2122
use std::serialize::{Encodable, Decodable, Encoder, Decoder};
2223

@@ -121,6 +122,20 @@ pub struct Lifetime {
121122
ident: ident
122123
}
123124

125+
#[cfg(stage0)]
126+
impl to_bytes::IterBytes for Lifetime {
127+
fn iter_bytes(&self, lsb0: bool, f: to_bytes::Cb) {
128+
to_bytes::iter_bytes_3(&self.id, &self.span, &self.ident, lsb0, f)
129+
}
130+
}
131+
132+
#[cfg(not(stage0))]
133+
impl to_bytes::IterBytes for Lifetime {
134+
fn iter_bytes(&self, lsb0: bool, f: to_bytes::Cb) -> bool {
135+
to_bytes::iter_bytes_3(&self.id, &self.span, &self.ident, lsb0, f)
136+
}
137+
}
138+
124139
// a "Path" is essentially Rust's notion of a name;
125140
// for instance: core::cmp::Eq . It's represented
126141
// as a sequence of identifiers, along with a bunch
@@ -1057,6 +1072,32 @@ pub enum self_ty_ {
10571072
sty_uniq(mutability) // `~self`
10581073
}
10591074
1075+
#[cfg(stage0)]
1076+
impl to_bytes::IterBytes for self_ty_ {
1077+
fn iter_bytes(&self, lsb0: bool, f: to_bytes::Cb) {
1078+
match *self {
1079+
sty_static => 0u8.iter_bytes(lsb0, f),
1080+
sty_value => 1u8.iter_bytes(lsb0, f),
1081+
sty_region(ref lft, ref mutbl) => to_bytes::iter_bytes_3(&2u8, &lft, mutbl, lsb0, f),
1082+
sty_box(ref mutbl) => to_bytes::iter_bytes_2(&3u8, mutbl, lsb0, f),
1083+
sty_uniq(ref mutbl) => to_bytes::iter_bytes_2(&4u8, mutbl, lsb0, f),
1084+
}
1085+
}
1086+
}
1087+
1088+
#[cfg(not(stage0))]
1089+
impl to_bytes::IterBytes for self_ty_ {
1090+
fn iter_bytes(&self, lsb0: bool, f: to_bytes::Cb) -> bool {
1091+
match *self {
1092+
sty_static => 0u8.iter_bytes(lsb0, f),
1093+
sty_value => 1u8.iter_bytes(lsb0, f),
1094+
sty_region(ref lft, ref mutbl) => to_bytes::iter_bytes_3(&2u8, &lft, mutbl, lsb0, f),
1095+
sty_box(ref mutbl) => to_bytes::iter_bytes_2(&3u8, mutbl, lsb0, f),
1096+
sty_uniq(ref mutbl) => to_bytes::iter_bytes_2(&4u8, mutbl, lsb0, f),
1097+
}
1098+
}
1099+
}
1100+
10601101
pub type self_ty = spanned<self_ty_>;
10611102
10621103
#[auto_encode]

branches/try/src/libsyntax/codemap.rs

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,20 @@ impl<D:Decoder> Decodable<D> for span {
152152
}
153153
}
154154

155+
#[cfg(stage0)]
156+
impl to_bytes::IterBytes for span {
157+
fn iter_bytes(&self, lsb0: bool, f: to_bytes::Cb) {
158+
to_bytes::iter_bytes_3(&self.lo, &self.hi, &self.expn_info, lsb0, f);
159+
}
160+
}
161+
162+
#[cfg(not(stage0))]
163+
impl to_bytes::IterBytes for span {
164+
fn iter_bytes(&self, lsb0: bool, f: to_bytes::Cb) -> bool {
165+
to_bytes::iter_bytes_3(&self.lo, &self.hi, &self.expn_info, lsb0, f)
166+
}
167+
}
168+
155169
pub fn spanned<T>(lo: BytePos, hi: BytePos, t: T) -> spanned<T> {
156170
respan(mk_sp(lo, hi), t)
157171
}
@@ -199,16 +213,62 @@ pub struct FileMapAndLine {fm: @FileMap, line: uint}
199213
pub struct FileMapAndBytePos {fm: @FileMap, pos: BytePos}
200214
pub struct NameAndSpan {name: ~str, span: Option<span>}
201215

216+
#[cfg(stage0)]
217+
impl to_bytes::IterBytes for NameAndSpan {
218+
fn iter_bytes(&self, lsb0: bool, f: to_bytes::Cb) {
219+
to_bytes::iter_bytes_2(&self.name, &self.span, lsb0, f)
220+
}
221+
}
222+
223+
#[cfg(not(stage0))]
224+
impl to_bytes::IterBytes for NameAndSpan {
225+
fn iter_bytes(&self, lsb0: bool, f: to_bytes::Cb) -> bool {
226+
to_bytes::iter_bytes_2(&self.name, &self.span, lsb0, f)
227+
}
228+
}
229+
202230
pub struct CallInfo {
203231
call_site: span,
204232
callee: NameAndSpan
205233
}
206234

235+
#[cfg(stage0)]
236+
impl to_bytes::IterBytes for CallInfo {
237+
fn iter_bytes(&self, lsb0: bool, f: to_bytes::Cb) {
238+
to_bytes::iter_bytes_2(&self.call_site, &self.callee, lsb0, f)
239+
}
240+
}
241+
242+
#[cfg(not(stage0))]
243+
impl to_bytes::IterBytes for CallInfo {
244+
fn iter_bytes(&self, lsb0: bool, f: to_bytes::Cb) -> bool {
245+
to_bytes::iter_bytes_2(&self.call_site, &self.callee, lsb0, f)
246+
}
247+
}
248+
207249
/// Extra information for tracking macro expansion of spans
208250
pub enum ExpnInfo {
209251
ExpandedFrom(CallInfo)
210252
}
211253

254+
#[cfg(stage0)]
255+
impl to_bytes::IterBytes for ExpnInfo {
256+
fn iter_bytes(&self, lsb0: bool, f: to_bytes::Cb) {
257+
match *self {
258+
ExpandedFrom(ref call_info) => to_bytes::iter_bytes_2(&0u8, call_info, lsb0, f)
259+
}
260+
}
261+
}
262+
263+
#[cfg(not(stage0))]
264+
impl to_bytes::IterBytes for ExpnInfo {
265+
fn iter_bytes(&self, lsb0: bool, f: to_bytes::Cb) -> bool {
266+
match *self {
267+
ExpandedFrom(ref call_info) => to_bytes::iter_bytes_2(&0u8, call_info, lsb0, f)
268+
}
269+
}
270+
}
271+
212272
pub type FileName = ~str;
213273

214274
pub struct FileLines

0 commit comments

Comments
 (0)