diff options
author | Aleksey Kladov <[email protected]> | 2019-01-06 14:33:27 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-01-06 14:36:10 +0000 |
commit | fd4456d0ec88e3433a7a8be6f27d8af9afedefe5 (patch) | |
tree | 37f1225b085e22756cbfd65875595c60205cc93a /crates/ra_hir/src/code_model_api.rs | |
parent | 5a505189a8f7ed274893a45aed0d0249083d1277 (diff) |
flatten module structure
Diffstat (limited to 'crates/ra_hir/src/code_model_api.rs')
-rw-r--r-- | crates/ra_hir/src/code_model_api.rs | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/crates/ra_hir/src/code_model_api.rs b/crates/ra_hir/src/code_model_api.rs index d00d3246f..09b532f74 100644 --- a/crates/ra_hir/src/code_model_api.rs +++ b/crates/ra_hir/src/code_model_api.rs | |||
@@ -1,7 +1,8 @@ | |||
1 | use relative_path::RelativePathBuf; | ||
1 | use ra_db::{CrateId, Cancelable, FileId}; | 2 | use ra_db::{CrateId, Cancelable, FileId}; |
2 | use ra_syntax::{ast, SyntaxNode}; | 3 | use ra_syntax::{ast, SyntaxNode}; |
3 | 4 | ||
4 | use crate::{Name, db::HirDatabase, DefId, Path, PerNs, module::{Problem, ModuleScope}}; | 5 | use crate::{Name, db::HirDatabase, DefId, Path, PerNs, nameres::ModuleScope}; |
5 | 6 | ||
6 | /// hir::Crate describes a single crate. It's the main inteface with which | 7 | /// 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 | 8 | /// crate's dependencies interact. Mostly, it should be just a proxy for the |
@@ -39,6 +40,17 @@ pub enum ModuleSource { | |||
39 | Module(ast::ModuleNode), | 40 | Module(ast::ModuleNode), |
40 | } | 41 | } |
41 | 42 | ||
43 | #[derive(Clone, Debug, Hash, PartialEq, Eq)] | ||
44 | pub enum Problem { | ||
45 | UnresolvedModule { | ||
46 | candidate: RelativePathBuf, | ||
47 | }, | ||
48 | NotDirOwner { | ||
49 | move_to: RelativePathBuf, | ||
50 | candidate: RelativePathBuf, | ||
51 | }, | ||
52 | } | ||
53 | |||
42 | impl Module { | 54 | impl Module { |
43 | /// Name of this module. | 55 | /// Name of this module. |
44 | pub fn name(&self, db: &impl HirDatabase) -> Cancelable<Option<Name>> { | 56 | pub fn name(&self, db: &impl HirDatabase) -> Cancelable<Option<Name>> { |