diff options
Diffstat (limited to 'crates/ra_hir_def/src/body.rs')
-rw-r--r-- | crates/ra_hir_def/src/body.rs | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/crates/ra_hir_def/src/body.rs b/crates/ra_hir_def/src/body.rs index 7fac6ce66..eafaf48c1 100644 --- a/crates/ra_hir_def/src/body.rs +++ b/crates/ra_hir_def/src/body.rs | |||
@@ -9,6 +9,8 @@ use drop_bomb::DropBomb; | |||
9 | use either::Either; | 9 | use either::Either; |
10 | use hir_expand::{ast_id_map::AstIdMap, hygiene::Hygiene, AstId, HirFileId, InFile, MacroDefId}; | 10 | use hir_expand::{ast_id_map::AstIdMap, hygiene::Hygiene, AstId, HirFileId, InFile, MacroDefId}; |
11 | use ra_arena::{map::ArenaMap, Arena}; | 11 | use ra_arena::{map::ArenaMap, Arena}; |
12 | use ra_cfg::CfgOptions; | ||
13 | use ra_db::CrateId; | ||
12 | use ra_prof::profile; | 14 | use ra_prof::profile; |
13 | use ra_syntax::{ast, AstNode, AstPtr}; | 15 | use ra_syntax::{ast, AstNode, AstPtr}; |
14 | use rustc_hash::FxHashMap; | 16 | use rustc_hash::FxHashMap; |
@@ -24,8 +26,6 @@ use crate::{ | |||
24 | src::HasSource, | 26 | src::HasSource, |
25 | AsMacroCall, DefWithBodyId, HasModule, Lookup, ModuleId, | 27 | AsMacroCall, DefWithBodyId, HasModule, Lookup, ModuleId, |
26 | }; | 28 | }; |
27 | use ra_cfg::CfgOptions; | ||
28 | use ra_db::CrateId; | ||
29 | 29 | ||
30 | /// A subser of Exander that only deals with cfg attributes. We only need it to | 30 | /// A subser of Exander that only deals with cfg attributes. We only need it to |
31 | /// avoid cyclic queries in crate def map during enum processing. | 31 | /// avoid cyclic queries in crate def map during enum processing. |
@@ -187,7 +187,7 @@ pub struct Body { | |||
187 | pub item_scope: ItemScope, | 187 | pub item_scope: ItemScope, |
188 | } | 188 | } |
189 | 189 | ||
190 | pub type ExprPtr = Either<AstPtr<ast::Expr>, AstPtr<ast::RecordField>>; | 190 | pub type ExprPtr = AstPtr<ast::Expr>; |
191 | pub type ExprSource = InFile<ExprPtr>; | 191 | pub type ExprSource = InFile<ExprPtr>; |
192 | 192 | ||
193 | pub type PatPtr = Either<AstPtr<ast::Pat>, AstPtr<ast::SelfParam>>; | 193 | pub type PatPtr = Either<AstPtr<ast::Pat>, AstPtr<ast::SelfParam>>; |
@@ -285,7 +285,7 @@ impl BodySourceMap { | |||
285 | } | 285 | } |
286 | 286 | ||
287 | pub fn node_expr(&self, node: InFile<&ast::Expr>) -> Option<ExprId> { | 287 | pub fn node_expr(&self, node: InFile<&ast::Expr>) -> Option<ExprId> { |
288 | let src = node.map(|it| Either::Left(AstPtr::new(it))); | 288 | let src = node.map(|it| AstPtr::new(it)); |
289 | self.expr_map.get(&src).cloned() | 289 | self.expr_map.get(&src).cloned() |
290 | } | 290 | } |
291 | 291 | ||
@@ -294,11 +294,6 @@ impl BodySourceMap { | |||
294 | self.expansions.get(&src).cloned() | 294 | self.expansions.get(&src).cloned() |
295 | } | 295 | } |
296 | 296 | ||
297 | pub fn field_init_shorthand_expr(&self, node: InFile<&ast::RecordField>) -> Option<ExprId> { | ||
298 | let src = node.map(|it| Either::Right(AstPtr::new(it))); | ||
299 | self.expr_map.get(&src).cloned() | ||
300 | } | ||
301 | |||
302 | pub fn pat_syntax(&self, pat: PatId) -> Result<PatSource, SyntheticSyntax> { | 297 | pub fn pat_syntax(&self, pat: PatId) -> Result<PatSource, SyntheticSyntax> { |
303 | self.pat_map_back[pat].clone() | 298 | self.pat_map_back[pat].clone() |
304 | } | 299 | } |