diff options
author | Edwin Cheng <[email protected]> | 2019-11-04 18:09:16 +0000 |
---|---|---|
committer | Edwin Cheng <[email protected]> | 2019-11-04 18:09:16 +0000 |
commit | 604bdc6ffeea69dffed6d03f10b2fd4e05d04cda (patch) | |
tree | c1bdf4142663cf259c026ae134fd32c254707db5 /crates/ra_tt/src | |
parent | 7e28924012409352bbacbfebf9fac4e4409f09b8 (diff) |
Use macro_rules shift to map text ranges
Diffstat (limited to 'crates/ra_tt/src')
-rw-r--r-- | crates/ra_tt/src/lib.rs | 19 |
1 files changed, 2 insertions, 17 deletions
diff --git a/crates/ra_tt/src/lib.rs b/crates/ra_tt/src/lib.rs index 1449618f3..20c251ff4 100644 --- a/crates/ra_tt/src/lib.rs +++ b/crates/ra_tt/src/lib.rs | |||
@@ -25,26 +25,11 @@ use smol_str::SmolStr; | |||
25 | /// source token and making sure that identities are preserved during macro | 25 | /// source token and making sure that identities are preserved during macro |
26 | /// expansion. | 26 | /// expansion. |
27 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] | 27 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] |
28 | pub struct TokenId { | 28 | pub struct TokenId(pub u32); |
29 | token_id: u32, | ||
30 | map_id: u32, | ||
31 | } | ||
32 | 29 | ||
33 | impl TokenId { | 30 | impl TokenId { |
34 | pub fn new(token_id: u32, map_id: u32) -> TokenId { | ||
35 | TokenId { token_id, map_id } | ||
36 | } | ||
37 | |||
38 | pub const fn unspecified() -> TokenId { | 31 | pub const fn unspecified() -> TokenId { |
39 | TokenId { token_id: !0, map_id: !0 } | 32 | TokenId(!0) |
40 | } | ||
41 | |||
42 | pub fn token_id(&self) -> u32 { | ||
43 | self.token_id | ||
44 | } | ||
45 | |||
46 | pub fn map_id(&self) -> u32 { | ||
47 | self.map_id | ||
48 | } | 33 | } |
49 | } | 34 | } |
50 | 35 | ||