From ac5a3f611b05dbedd286169539335ae9f0fbb7b0 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 20 Dec 2019 12:20:49 +0100 Subject: Support for nested ADT --- crates/ra_hir/src/code_model.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'crates/ra_hir') diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs index 8dbc0d667..d20e9de63 100644 --- a/crates/ra_hir/src/code_model.rs +++ b/crates/ra_hir/src/code_model.rs @@ -269,7 +269,7 @@ pub struct Struct { impl Struct { pub fn module(self, db: &impl DefDatabase) -> Module { - Module { id: self.id.lookup(db).container } + Module { id: self.id.lookup(db).container.module(db) } } pub fn krate(self, db: &impl DefDatabase) -> Option { @@ -290,7 +290,7 @@ impl Struct { } pub fn ty(self, db: &impl HirDatabase) -> Type { - Type::from_def(db, self.id.lookup(db).container.krate, self.id) + Type::from_def(db, self.id.lookup(db).container.module(db).krate, self.id) } fn variant_data(self, db: &impl DefDatabase) -> Arc { @@ -309,11 +309,11 @@ impl Union { } pub fn module(self, db: &impl DefDatabase) -> Module { - Module { id: self.id.lookup(db).container } + Module { id: self.id.lookup(db).container.module(db) } } pub fn ty(self, db: &impl HirDatabase) -> Type { - Type::from_def(db, self.id.lookup(db).container.krate, self.id) + Type::from_def(db, self.id.lookup(db).container.module(db).krate, self.id) } pub fn fields(self, db: &impl HirDatabase) -> Vec { @@ -337,7 +337,7 @@ pub struct Enum { impl Enum { pub fn module(self, db: &impl DefDatabase) -> Module { - Module { id: self.id.lookup(db).container } + Module { id: self.id.lookup(db).container.module(db) } } pub fn krate(self, db: &impl DefDatabase) -> Option { @@ -357,7 +357,7 @@ impl Enum { } pub fn ty(self, db: &impl HirDatabase) -> Type { - Type::from_def(db, self.id.lookup(db).container.krate, self.id) + Type::from_def(db, self.id.lookup(db).container.module(db).krate, self.id) } } -- cgit v1.2.3 From f42697e54b9d0a040011cb04c266d51710e249f1 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 20 Dec 2019 12:29:25 +0100 Subject: Support for nested traits --- crates/ra_hir/src/code_model.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'crates/ra_hir') diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs index d20e9de63..35e1f752b 100644 --- a/crates/ra_hir/src/code_model.rs +++ b/crates/ra_hir/src/code_model.rs @@ -553,7 +553,7 @@ pub struct Trait { impl Trait { pub fn module(self, db: &impl DefDatabase) -> Module { - Module { id: self.id.lookup(db).container } + Module { id: self.id.lookup(db).container.module(db) } } pub fn name(self, db: &impl DefDatabase) -> Name { -- cgit v1.2.3