diff options
Diffstat (limited to 'crates/ra_hir/src/code_model_api.rs')
-rw-r--r-- | crates/ra_hir/src/code_model_api.rs | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/crates/ra_hir/src/code_model_api.rs b/crates/ra_hir/src/code_model_api.rs index 236cb3ab4..eca7d0225 100644 --- a/crates/ra_hir/src/code_model_api.rs +++ b/crates/ra_hir/src/code_model_api.rs | |||
@@ -1,7 +1,6 @@ | |||
1 | use ra_db::{CrateId, Cancelable, FileId}; | 1 | use ra_db::{CrateId, Cancelable}; |
2 | use ra_syntax::ast; | ||
3 | 2 | ||
4 | use crate::{Name, db::HirDatabase, DefId, Path, PerNs}; | 3 | use crate::{Name, db::HirDatabase, DefId, Path, PerNs, module::{ModuleSource, ModuleScope}}; |
5 | 4 | ||
6 | /// hir::Crate describes a single crate. It's the main inteface with which | 5 | /// hir::Crate describes a single crate. It's the main inteface with which |
7 | /// crate's dependencies interact. Mostly, it should be just a proxy for the | 6 | /// crate's dependencies interact. Mostly, it should be just a proxy for the |
@@ -35,7 +34,8 @@ pub struct Module { | |||
35 | } | 34 | } |
36 | 35 | ||
37 | impl Module { | 36 | impl Module { |
38 | pub fn source(&self, db: &impl HirDatabase) -> Cancelable<(FileId, Option<ast::ModuleNode>)> { | 37 | // FIXME: what is a module source exactly? It should contain two nodes |
38 | pub fn source(&self, db: &impl HirDatabase) -> Cancelable<ModuleSource> { | ||
39 | Ok(self.source_impl(db)) | 39 | Ok(self.source_impl(db)) |
40 | } | 40 | } |
41 | 41 | ||
@@ -56,7 +56,10 @@ impl Module { | |||
56 | pub fn parent(&self, db: &impl HirDatabase) -> Cancelable<Option<Module>> { | 56 | pub fn parent(&self, db: &impl HirDatabase) -> Cancelable<Option<Module>> { |
57 | self.parent_impl(db) | 57 | self.parent_impl(db) |
58 | } | 58 | } |
59 | 59 | /// Returns a `ModuleScope`: a set of items, visible in this module. | |
60 | pub fn scope(&self, db: &impl HirDatabase) -> Cancelable<ModuleScope> { | ||
61 | self.scope_impl(db) | ||
62 | } | ||
60 | pub fn resolve_path(&self, db: &impl HirDatabase, path: &Path) -> Cancelable<PerNs<DefId>> { | 63 | pub fn resolve_path(&self, db: &impl HirDatabase, path: &Path) -> Cancelable<PerNs<DefId>> { |
61 | self.resolve_path_impl(db, path) | 64 | self.resolve_path_impl(db, path) |
62 | } | 65 | } |