diff options
Diffstat (limited to 'crates/ra_hir_def/src/nameres')
-rw-r--r-- | crates/ra_hir_def/src/nameres/collector.rs | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/crates/ra_hir_def/src/nameres/collector.rs b/crates/ra_hir_def/src/nameres/collector.rs index 15941a1cb..7a5f90327 100644 --- a/crates/ra_hir_def/src/nameres/collector.rs +++ b/crates/ra_hir_def/src/nameres/collector.rs | |||
@@ -599,8 +599,8 @@ where | |||
599 | } | 599 | } |
600 | 600 | ||
601 | fn collect_module(&mut self, module: &raw::ModuleData, attrs: &Attrs) { | 601 | fn collect_module(&mut self, module: &raw::ModuleData, attrs: &Attrs) { |
602 | let path_attr = attrs.find_string_value("path"); | 602 | let path_attr = attrs.by_key("path").string_value(); |
603 | let is_macro_use = attrs.has_atom("macro_use"); | 603 | let is_macro_use = attrs.by_key("macro_use").exists(); |
604 | match module { | 604 | match module { |
605 | // inline module, just recurse | 605 | // inline module, just recurse |
606 | raw::ModuleData::Definition { name, items, ast_id } => { | 606 | raw::ModuleData::Definition { name, items, ast_id } => { |
@@ -612,7 +612,7 @@ where | |||
612 | module_id, | 612 | module_id, |
613 | file_id: self.file_id, | 613 | file_id: self.file_id, |
614 | raw_items: self.raw_items, | 614 | raw_items: self.raw_items, |
615 | mod_dir: self.mod_dir.descend_into_definition(name, path_attr.as_ref()), | 615 | mod_dir: self.mod_dir.descend_into_definition(name, path_attr), |
616 | } | 616 | } |
617 | .collect(&*items); | 617 | .collect(&*items); |
618 | if is_macro_use { | 618 | if is_macro_use { |
@@ -626,7 +626,7 @@ where | |||
626 | self.def_collector.db, | 626 | self.def_collector.db, |
627 | self.file_id, | 627 | self.file_id, |
628 | name, | 628 | name, |
629 | path_attr.as_ref(), | 629 | path_attr, |
630 | ) { | 630 | ) { |
631 | Ok((file_id, mod_dir)) => { | 631 | Ok((file_id, mod_dir)) => { |
632 | let module_id = self.push_child_module(name.clone(), ast_id, Some(file_id)); | 632 | let module_id = self.push_child_module(name.clone(), ast_id, Some(file_id)); |
@@ -796,7 +796,11 @@ where | |||
796 | } | 796 | } |
797 | 797 | ||
798 | fn is_cfg_enabled(&self, attrs: &Attrs) -> bool { | 798 | fn is_cfg_enabled(&self, attrs: &Attrs) -> bool { |
799 | attrs.iter().all(|attr| attr.is_cfg_enabled(&self.def_collector.cfg_options) != Some(false)) | 799 | // FIXME: handle cfg_attr :-) |
800 | attrs | ||
801 | .by_key("cfg") | ||
802 | .tt_values() | ||
803 | .all(|tt| self.def_collector.cfg_options.is_cfg_enabled(tt) != Some(false)) | ||
800 | } | 804 | } |
801 | } | 805 | } |
802 | 806 | ||