librustc: Add explicit self to IterBytes. r=nmatsakis

This commit is contained in:
Patrick Walton 2012-11-28 11:36:04 -08:00
parent 430583c8b4
commit 669fbddc44
13 changed files with 903 additions and 14 deletions

View file

@ -90,12 +90,21 @@ impl BytePos: Num {
static pure fn from_int(+n: int) -> BytePos { BytePos(n as uint) }
}
#[cfg(stage0)]
impl BytePos: to_bytes::IterBytes {
pure fn iter_bytes(+lsb0: bool, f: to_bytes::Cb) {
(*self).iter_bytes(lsb0, f)
}
}
#[cfg(stage1)]
#[cfg(stage2)]
impl BytePos: to_bytes::IterBytes {
pure fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
(**self).iter_bytes(lsb0, f)
}
}
impl CharPos: Pos {
static pure fn from_uint(n: uint) -> CharPos { CharPos(n) }
pure fn to_uint(&self) -> uint { **self }
@ -154,11 +163,19 @@ impl CharPos: Num {
static pure fn from_int(+n: int) -> CharPos { CharPos(n as uint) }
}
#[cfg(stage0)]
impl CharPos: to_bytes::IterBytes {
pure fn iter_bytes(+lsb0: bool, f: to_bytes::Cb) {
(*self).iter_bytes(lsb0, f)
}
}
#[cfg(stage1)]
#[cfg(stage2)]
impl CharPos: to_bytes::IterBytes {
pure fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
(**self).iter_bytes(lsb0, f)
}
}
/**
Spans represent a region of code, used for error reporting. Positions in spans