diff options
author | Aleksey Kladov <[email protected]> | 2019-12-12 14:11:57 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-12-12 14:11:57 +0000 |
commit | 56710f119b7114efac237ac36ea21730b8bd5311 (patch) | |
tree | 9e54318d6f291e3d997a9fe99554c24eeb4a47bc /crates/ra_hir_def/src/nameres/collector.rs | |
parent | f135a8ea55c0a46c67713fb3b79b5f62ada430c1 (diff) |
Move enum&union to new loc
Diffstat (limited to 'crates/ra_hir_def/src/nameres/collector.rs')
-rw-r--r-- | crates/ra_hir_def/src/nameres/collector.rs | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/crates/ra_hir_def/src/nameres/collector.rs b/crates/ra_hir_def/src/nameres/collector.rs index 602ec0911..04aadead1 100644 --- a/crates/ra_hir_def/src/nameres/collector.rs +++ b/crates/ra_hir_def/src/nameres/collector.rs | |||
@@ -24,9 +24,9 @@ use crate::{ | |||
24 | }, | 24 | }, |
25 | path::{Path, PathKind}, | 25 | path::{Path, PathKind}, |
26 | per_ns::PerNs, | 26 | per_ns::PerNs, |
27 | AdtId, AstId, AstItemDef, ConstLoc, ContainerId, EnumId, EnumVariantId, FunctionLoc, ImplLoc, | 27 | AdtId, AstId, ConstLoc, ContainerId, EnumLoc, EnumVariantId, FunctionLoc, ImplLoc, Intern, |
28 | Intern, LocalImportId, LocalModuleId, LocationCtx, ModuleDefId, ModuleId, StaticLoc, StructLoc, | 28 | LocalImportId, LocalModuleId, ModuleDefId, ModuleId, StaticLoc, StructLoc, TraitLoc, |
29 | TraitLoc, TypeAliasLoc, UnionId, | 29 | TypeAliasLoc, UnionLoc, |
30 | }; | 30 | }; |
31 | 31 | ||
32 | pub(super) fn collect_defs(db: &impl DefDatabase, mut def_map: CrateDefMap) -> CrateDefMap { | 32 | pub(super) fn collect_defs(db: &impl DefDatabase, mut def_map: CrateDefMap) -> CrateDefMap { |
@@ -753,8 +753,6 @@ where | |||
753 | 753 | ||
754 | fn define_def(&mut self, def: &raw::DefData, attrs: &Attrs) { | 754 | fn define_def(&mut self, def: &raw::DefData, attrs: &Attrs) { |
755 | let module = ModuleId { krate: self.def_collector.def_map.krate, local_id: self.module_id }; | 755 | let module = ModuleId { krate: self.def_collector.def_map.krate, local_id: self.module_id }; |
756 | let ctx = LocationCtx::new(self.def_collector.db, module, self.file_id); | ||
757 | |||
758 | // FIXME: check attrs to see if this is an attribute macro invocation; | 756 | // FIXME: check attrs to see if this is an attribute macro invocation; |
759 | // in which case we don't add the invocation, just a single attribute | 757 | // in which case we don't add the invocation, just a single attribute |
760 | // macro invocation | 758 | // macro invocation |
@@ -778,10 +776,15 @@ where | |||
778 | PerNs::both(def.into(), def.into()) | 776 | PerNs::both(def.into(), def.into()) |
779 | } | 777 | } |
780 | raw::DefKind::Union(ast_id) => { | 778 | raw::DefKind::Union(ast_id) => { |
781 | let id = UnionId::from_ast_id(ctx, ast_id).into(); | 779 | let def = UnionLoc { container: module, ast_id: AstId::new(self.file_id, ast_id) } |
782 | PerNs::both(id, id) | 780 | .intern(self.def_collector.db); |
781 | PerNs::both(def.into(), def.into()) | ||
782 | } | ||
783 | raw::DefKind::Enum(ast_id) => { | ||
784 | let def = EnumLoc { container: module, ast_id: AstId::new(self.file_id, ast_id) } | ||
785 | .intern(self.def_collector.db); | ||
786 | PerNs::types(def.into()) | ||
783 | } | 787 | } |
784 | raw::DefKind::Enum(ast_id) => PerNs::types(EnumId::from_ast_id(ctx, ast_id).into()), | ||
785 | raw::DefKind::Const(ast_id) => { | 788 | raw::DefKind::Const(ast_id) => { |
786 | let def = ConstLoc { | 789 | let def = ConstLoc { |
787 | container: ContainerId::ModuleId(module), | 790 | container: ContainerId::ModuleId(module), |