diff options
Diffstat (limited to 'crates/ra_tt/src')
-rw-r--r-- | crates/ra_tt/src/lib.rs | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/crates/ra_tt/src/lib.rs b/crates/ra_tt/src/lib.rs index 20c251ff4..96410ff22 100644 --- a/crates/ra_tt/src/lib.rs +++ b/crates/ra_tt/src/lib.rs | |||
@@ -25,11 +25,23 @@ 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(pub u32); | 28 | pub struct TokenId(u32, u32); |
29 | 29 | ||
30 | impl TokenId { | 30 | impl TokenId { |
31 | pub fn new(token_id: u32, map_id: u32) -> TokenId { | ||
32 | TokenId(token_id, map_id) | ||
33 | } | ||
34 | |||
31 | pub const fn unspecified() -> TokenId { | 35 | pub const fn unspecified() -> TokenId { |
32 | TokenId(!0) | 36 | TokenId(!0, !0) |
37 | } | ||
38 | |||
39 | pub fn token_id(&self) -> u32 { | ||
40 | self.0 | ||
41 | } | ||
42 | |||
43 | pub fn map_id(&self) -> u32 { | ||
44 | self.1 | ||
33 | } | 45 | } |
34 | } | 46 | } |
35 | 47 | ||