diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-12-29 15:02:27 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2019-12-29 15:02:27 +0000 |
commit | 523b4cbc602447b14202dd2520f84241bb07c4e2 (patch) | |
tree | b145912b63ff25ab6130853867698e622ef50fcc /crates/ra_hir_def/src/body.rs | |
parent | ada9e16537c22b490d13cdd54b9e1e4885856a4c (diff) | |
parent | 12cc2ed5572e4df8cfbdaef79ed3c865fda0764c (diff) |
Merge #2650
2650: Add macro call support for SourceAnalyzer::type_of r=matklad a=edwin0cheng
Co-authored-by: Edwin Cheng <[email protected]>
Diffstat (limited to 'crates/ra_hir_def/src/body.rs')
-rw-r--r-- | crates/ra_hir_def/src/body.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/crates/ra_hir_def/src/body.rs b/crates/ra_hir_def/src/body.rs index d3e4c50ae..142c52d35 100644 --- a/crates/ra_hir_def/src/body.rs +++ b/crates/ra_hir_def/src/body.rs | |||
@@ -163,6 +163,7 @@ pub struct BodySourceMap { | |||
163 | pat_map: FxHashMap<PatSource, PatId>, | 163 | pat_map: FxHashMap<PatSource, PatId>, |
164 | pat_map_back: ArenaMap<PatId, PatSource>, | 164 | pat_map_back: ArenaMap<PatId, PatSource>, |
165 | field_map: FxHashMap<(ExprId, usize), AstPtr<ast::RecordField>>, | 165 | field_map: FxHashMap<(ExprId, usize), AstPtr<ast::RecordField>>, |
166 | expansions: FxHashMap<InFile<AstPtr<ast::MacroCall>>, HirFileId>, | ||
166 | } | 167 | } |
167 | 168 | ||
168 | impl Body { | 169 | impl Body { |
@@ -237,6 +238,11 @@ impl BodySourceMap { | |||
237 | self.expr_map.get(&src).cloned() | 238 | self.expr_map.get(&src).cloned() |
238 | } | 239 | } |
239 | 240 | ||
241 | pub fn node_macro_file(&self, node: InFile<&ast::MacroCall>) -> Option<HirFileId> { | ||
242 | let src = node.map(|it| AstPtr::new(it)); | ||
243 | self.expansions.get(&src).cloned() | ||
244 | } | ||
245 | |||
240 | pub fn field_init_shorthand_expr(&self, node: InFile<&ast::RecordField>) -> Option<ExprId> { | 246 | pub fn field_init_shorthand_expr(&self, node: InFile<&ast::RecordField>) -> Option<ExprId> { |
241 | let src = node.map(|it| Either::Right(AstPtr::new(it))); | 247 | let src = node.map(|it| Either::Right(AstPtr::new(it))); |
242 | self.expr_map.get(&src).cloned() | 248 | self.expr_map.get(&src).cloned() |