Skip to content

Commit c56a524

Browse files
author
Jorge Aparicio
committed
---
yaml --- r: 163435 b: refs/heads/snap-stage3 c: 265b89a h: refs/heads/master i: 163433: 053f8d0 163431: 5565092 v: v3
1 parent 0add471 commit c56a524

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 9146a919b616e39e528e4d7100d16eef52f1f852
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: b5537fa838112192f0ed1f1593c574fe621497a6
4+
refs/heads/snap-stage3: 265b89abde76f7e0555712d7c9056c6f6c57ff96
55
refs/heads/try: 20cbbffeefc1f35e2ea63afce7b42fbd79611d42
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d

branches/snap-stage3/src/libsyntax/codemap.rs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,35 +52,71 @@ impl Pos for BytePos {
5252
fn to_uint(&self) -> uint { let BytePos(n) = *self; n as uint }
5353
}
5454

55+
// NOTE(stage0): Remove impl after a snapshot
56+
#[cfg(stage0)]
5557
impl Add<BytePos, BytePos> for BytePos {
5658
fn add(&self, rhs: &BytePos) -> BytePos {
5759
BytePos((self.to_uint() + rhs.to_uint()) as u32)
5860
}
5961
}
6062

63+
#[cfg(not(stage0))] // NOTE(stage0): Remove cfg after a snapshot
64+
impl Add<BytePos, BytePos> for BytePos {
65+
fn add(self, rhs: BytePos) -> BytePos {
66+
BytePos((self.to_uint() + rhs.to_uint()) as u32)
67+
}
68+
}
69+
70+
// NOTE(stage0): Remove impl after a snapshot
71+
#[cfg(stage0)]
6172
impl Sub<BytePos, BytePos> for BytePos {
6273
fn sub(&self, rhs: &BytePos) -> BytePos {
6374
BytePos((self.to_uint() - rhs.to_uint()) as u32)
6475
}
6576
}
6677

78+
#[cfg(not(stage0))] // NOTE(stage0): Remove cfg after a snapshot
79+
impl Sub<BytePos, BytePos> for BytePos {
80+
fn sub(self, rhs: BytePos) -> BytePos {
81+
BytePos((self.to_uint() - rhs.to_uint()) as u32)
82+
}
83+
}
84+
6785
impl Pos for CharPos {
6886
fn from_uint(n: uint) -> CharPos { CharPos(n) }
6987
fn to_uint(&self) -> uint { let CharPos(n) = *self; n }
7088
}
7189

90+
// NOTE(stage0): Remove impl after a snapshot
91+
#[cfg(stage0)]
7292
impl Add<CharPos,CharPos> for CharPos {
7393
fn add(&self, rhs: &CharPos) -> CharPos {
7494
CharPos(self.to_uint() + rhs.to_uint())
7595
}
7696
}
7797

98+
#[cfg(not(stage0))] // NOTE(stage0): Remove cfg after a snapshot
99+
impl Add<CharPos, CharPos> for CharPos {
100+
fn add(self, rhs: CharPos) -> CharPos {
101+
CharPos(self.to_uint() + rhs.to_uint())
102+
}
103+
}
104+
105+
// NOTE(stage0): Remove impl after a snapshot
106+
#[cfg(stage0)]
78107
impl Sub<CharPos,CharPos> for CharPos {
79108
fn sub(&self, rhs: &CharPos) -> CharPos {
80109
CharPos(self.to_uint() - rhs.to_uint())
81110
}
82111
}
83112

113+
#[cfg(not(stage0))] // NOTE(stage0): Remove cfg after a snapshot
114+
impl Sub<CharPos, CharPos> for CharPos {
115+
fn sub(self, rhs: CharPos) -> CharPos {
116+
CharPos(self.to_uint() - rhs.to_uint())
117+
}
118+
}
119+
84120
/// Spans represent a region of code, used for error reporting. Positions in spans
85121
/// are *absolute* positions from the beginning of the codemap, not positions
86122
/// relative to FileMaps. Methods on the CodeMap can be used to relate spans back

0 commit comments

Comments
 (0)