diff options
Diffstat (limited to 'crates/ra_hir_expand')
-rw-r--r-- | crates/ra_hir_expand/src/db.rs | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/crates/ra_hir_expand/src/db.rs b/crates/ra_hir_expand/src/db.rs index e2860371f..1eaf8bf30 100644 --- a/crates/ra_hir_expand/src/db.rs +++ b/crates/ra_hir_expand/src/db.rs | |||
@@ -148,17 +148,15 @@ pub(crate) fn parse_macro_with_info( | |||
148 | let arg_tt = loc.ast_id.to_node(db).token_tree(); | 148 | let arg_tt = loc.ast_id.to_node(db).token_tree(); |
149 | let def_tt = loc.def.ast_id.to_node(db).token_tree(); | 149 | let def_tt = loc.def.ast_id.to_node(db).token_tree(); |
150 | 150 | ||
151 | let arg_start = arg_tt.map(|t| t.syntax().text_range().start()); | 151 | let arg_range = arg_tt.map(|t| t.syntax().text_range()); |
152 | let def_start = def_tt.map(|t| t.syntax().text_range().start()); | 152 | let def_range = def_tt.map(|t| t.syntax().text_range()); |
153 | 153 | ||
154 | let shift = db.macro_def(loc.def)?.0.shift(); | 154 | let shift = db.macro_def(loc.def)?.0.shift(); |
155 | 155 | ||
156 | let arg_map = arg_start | 156 | let arg_map = |
157 | .map(|start| exp_map.map_ranges(&expand_info.arg_map, start, shift)) | 157 | arg_range.map(|it| exp_map.map_ranges(&expand_info.arg_map, it, shift)).unwrap_or_default(); |
158 | .unwrap_or_default(); | 158 | let def_map = |
159 | let def_map = def_start | 159 | def_range.map(|it| exp_map.map_ranges(&expand_info.def_map, it, 0)).unwrap_or_default(); |
160 | .map(|start| exp_map.map_ranges(&expand_info.def_map, start, 0)) | ||
161 | .unwrap_or_default(); | ||
162 | 160 | ||
163 | let info = ExpansionInfo { arg_map, def_map }; | 161 | let info = ExpansionInfo { arg_map, def_map }; |
164 | 162 | ||