diff options
Diffstat (limited to 'crates/ra_hir_def/src/body.rs')
-rw-r--r-- | crates/ra_hir_def/src/body.rs | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/crates/ra_hir_def/src/body.rs b/crates/ra_hir_def/src/body.rs index 3b169440a..f5a7305dc 100644 --- a/crates/ra_hir_def/src/body.rs +++ b/crates/ra_hir_def/src/body.rs | |||
@@ -15,6 +15,8 @@ use ra_prof::profile; | |||
15 | use ra_syntax::{ast, AstNode, AstPtr}; | 15 | use ra_syntax::{ast, AstNode, AstPtr}; |
16 | use rustc_hash::FxHashMap; | 16 | use rustc_hash::FxHashMap; |
17 | 17 | ||
18 | pub(crate) use lower::LowerCtx; | ||
19 | |||
18 | use crate::{ | 20 | use crate::{ |
19 | attr::Attrs, | 21 | attr::Attrs, |
20 | db::DefDatabase, | 22 | db::DefDatabase, |
@@ -27,7 +29,7 @@ use crate::{ | |||
27 | AsMacroCall, DefWithBodyId, HasModule, Lookup, ModuleId, | 29 | AsMacroCall, DefWithBodyId, HasModule, Lookup, ModuleId, |
28 | }; | 30 | }; |
29 | 31 | ||
30 | /// A subser of Exander that only deals with cfg attributes. We only need it to | 32 | /// A subset of Exander that only deals with cfg attributes. We only need it to |
31 | /// avoid cyclic queries in crate def map during enum processing. | 33 | /// avoid cyclic queries in crate def map during enum processing. |
32 | pub(crate) struct CfgExpander { | 34 | pub(crate) struct CfgExpander { |
33 | cfg_options: CfgOptions, | 35 | cfg_options: CfgOptions, |
@@ -58,7 +60,8 @@ impl CfgExpander { | |||
58 | Attrs::new(owner, &self.hygiene) | 60 | Attrs::new(owner, &self.hygiene) |
59 | } | 61 | } |
60 | 62 | ||
61 | pub(crate) fn is_cfg_enabled(&self, attrs: &Attrs) -> bool { | 63 | pub(crate) fn is_cfg_enabled(&self, owner: &dyn ast::AttrsOwner) -> bool { |
64 | let attrs = self.parse_attrs(owner); | ||
62 | attrs.is_cfg_enabled(&self.cfg_options) | 65 | attrs.is_cfg_enabled(&self.cfg_options) |
63 | } | 66 | } |
64 | } | 67 | } |
@@ -139,12 +142,8 @@ impl Expander { | |||
139 | InFile { file_id: self.current_file_id, value } | 142 | InFile { file_id: self.current_file_id, value } |
140 | } | 143 | } |
141 | 144 | ||
142 | pub(crate) fn parse_attrs(&self, owner: &dyn ast::AttrsOwner) -> Attrs { | 145 | pub(crate) fn is_cfg_enabled(&self, owner: &dyn ast::AttrsOwner) -> bool { |
143 | self.cfg_expander.parse_attrs(owner) | 146 | self.cfg_expander.is_cfg_enabled(owner) |
144 | } | ||
145 | |||
146 | pub(crate) fn is_cfg_enabled(&self, attrs: &Attrs) -> bool { | ||
147 | self.cfg_expander.is_cfg_enabled(attrs) | ||
148 | } | 147 | } |
149 | 148 | ||
150 | fn parse_path(&mut self, path: ast::Path) -> Option<Path> { | 149 | fn parse_path(&mut self, path: ast::Path) -> Option<Path> { |