aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/code_model/src.rs
diff options
context:
space:
mode:
authorSeivan Heidari <[email protected]>2019-11-04 12:45:27 +0000
committerSeivan Heidari <[email protected]>2019-11-04 12:45:27 +0000
commitdad9bc6caad71e6aebb92ad9883c08d30431e9b1 (patch)
tree6495d47108bc56ab0fbb358125fe65ebece8934f /crates/ra_hir/src/code_model/src.rs
parent1d8bb4c6c1fef1f8ea513e07d0a7d4c5483129d2 (diff)
parentcc2d75d0f88bdcb1b3e20db36decb6ee6eca517a (diff)
Merge branch 'master' into feature/themes
Diffstat (limited to 'crates/ra_hir/src/code_model/src.rs')
-rw-r--r--crates/ra_hir/src/code_model/src.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/crates/ra_hir/src/code_model/src.rs b/crates/ra_hir/src/code_model/src.rs
index 0f4c78df7..6d116ee75 100644
--- a/crates/ra_hir/src/code_model/src.rs
+++ b/crates/ra_hir/src/code_model/src.rs
@@ -10,7 +10,7 @@ use crate::{
10 ModuleSource, Static, Struct, StructField, Trait, TypeAlias, Union, 10 ModuleSource, Static, Struct, StructField, Trait, TypeAlias, Union,
11}; 11};
12 12
13pub use hir_def::Source; 13pub use hir_expand::Source;
14 14
15pub trait HasSource { 15pub trait HasSource {
16 type Ast; 16 type Ast;
@@ -22,7 +22,7 @@ pub trait HasSource {
22impl Module { 22impl Module {
23 /// Returns a node which defines this module. That is, a file or a `mod foo {}` with items. 23 /// Returns a node which defines this module. That is, a file or a `mod foo {}` with items.
24 pub fn definition_source(self, db: &(impl DefDatabase + AstDatabase)) -> Source<ModuleSource> { 24 pub fn definition_source(self, db: &(impl DefDatabase + AstDatabase)) -> Source<ModuleSource> {
25 let def_map = db.crate_def_map(self.krate()); 25 let def_map = db.crate_def_map(self.id.krate);
26 let decl_id = def_map[self.id.module_id].declaration; 26 let decl_id = def_map[self.id.module_id].declaration;
27 let file_id = def_map[self.id.module_id].definition; 27 let file_id = def_map[self.id.module_id].definition;
28 let ast = ModuleSource::new(db, file_id, decl_id); 28 let ast = ModuleSource::new(db, file_id, decl_id);
@@ -36,7 +36,7 @@ impl Module {
36 self, 36 self,
37 db: &(impl DefDatabase + AstDatabase), 37 db: &(impl DefDatabase + AstDatabase),
38 ) -> Option<Source<ast::Module>> { 38 ) -> Option<Source<ast::Module>> {
39 let def_map = db.crate_def_map(self.krate()); 39 let def_map = db.crate_def_map(self.id.krate);
40 let decl = def_map[self.id.module_id].declaration?; 40 let decl = def_map[self.id.module_id].declaration?;
41 let ast = decl.to_node(db); 41 let ast = decl.to_node(db);
42 Some(Source { file_id: decl.file_id(), ast }) 42 Some(Source { file_id: decl.file_id(), ast })