aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_expand/src/db.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir_expand/src/db.rs')
-rw-r--r--crates/ra_hir_expand/src/db.rs13
1 files changed, 10 insertions, 3 deletions
diff --git a/crates/ra_hir_expand/src/db.rs b/crates/ra_hir_expand/src/db.rs
index 5eadee9c2..9de7c1ea8 100644
--- a/crates/ra_hir_expand/src/db.rs
+++ b/crates/ra_hir_expand/src/db.rs
@@ -32,10 +32,17 @@ impl TokenExpander {
32 } 32 }
33 } 33 }
34 34
35 pub fn shift(&self) -> u32 { 35 pub fn map_id_down(&self, id: tt::TokenId) -> tt::TokenId {
36 match self { 36 match self {
37 TokenExpander::MacroRules(it) => it.shift(), 37 TokenExpander::MacroRules(it) => it.map_id_down(id),
38 TokenExpander::Builtin(_) => 0, 38 TokenExpander::Builtin(..) => id,
39 }
40 }
41
42 pub fn map_id_up(&self, id: tt::TokenId) -> (tt::TokenId, mbe::Origin) {
43 match self {
44 TokenExpander::MacroRules(it) => it.map_id_up(id),
45 TokenExpander::Builtin(..) => (id, mbe::Origin::Def),
39 } 46 }
40 } 47 }
41} 48}