diff options
author | Aleksey Kladov <[email protected]> | 2019-10-30 15:50:10 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-10-30 15:50:10 +0000 |
commit | b05d6e53fb0e9a008dc2e1220b1201818e63ed2d (patch) | |
tree | b3207114d918b50b17adc1db589454fed266eed7 | |
parent | 0bc7d285189caaffc13e4d6856baf895f72ed80c (diff) |
push either to hir_expand
-rw-r--r-- | crates/ra_hir/src/lib.rs | 17 | ||||
-rw-r--r-- | crates/ra_hir_def/src/hygiene.rs | 6 | ||||
-rw-r--r-- | crates/ra_hir_def/src/lib.rs | 1 | ||||
-rw-r--r-- | crates/ra_hir_def/src/nameres/raw.rs | 11 | ||||
-rw-r--r-- | crates/ra_hir_def/src/path.rs | 2 | ||||
-rw-r--r-- | crates/ra_hir_expand/src/either.rs (renamed from crates/ra_hir_def/src/either.rs) | 0 | ||||
-rw-r--r-- | crates/ra_hir_expand/src/lib.rs | 1 |
7 files changed, 16 insertions, 22 deletions
diff --git a/crates/ra_hir/src/lib.rs b/crates/ra_hir/src/lib.rs index f765490b0..989818c0e 100644 --- a/crates/ra_hir/src/lib.rs +++ b/crates/ra_hir/src/lib.rs | |||
@@ -60,6 +60,13 @@ use crate::{ids::MacroFileKind, resolve::Resolver}; | |||
60 | 60 | ||
61 | pub use crate::{ | 61 | pub use crate::{ |
62 | adt::VariantDef, | 62 | adt::VariantDef, |
63 | code_model::{ | ||
64 | docs::{DocDef, Docs, Documentation}, | ||
65 | src::{HasBodySource, HasSource, Source}, | ||
66 | Adt, AssocItem, BuiltinType, Const, ConstData, Container, Crate, CrateDependency, | ||
67 | DefWithBody, Enum, EnumVariant, FieldSource, FnData, Function, HasBody, MacroDef, Module, | ||
68 | ModuleDef, ModuleSource, Static, Struct, StructField, Trait, TypeAlias, Union, | ||
69 | }, | ||
63 | expr::ExprScopes, | 70 | expr::ExprScopes, |
64 | from_source::FromSource, | 71 | from_source::FromSource, |
65 | generics::{GenericDef, GenericParam, GenericParams, HasGenericParams}, | 72 | generics::{GenericDef, GenericParam, GenericParams, HasGenericParams}, |
@@ -73,17 +80,9 @@ pub use crate::{ | |||
73 | }, | 80 | }, |
74 | }; | 81 | }; |
75 | 82 | ||
76 | pub use self::code_model::{ | ||
77 | docs::{DocDef, Docs, Documentation}, | ||
78 | src::{HasBodySource, HasSource, Source}, | ||
79 | Adt, AssocItem, BuiltinType, Const, ConstData, Container, Crate, CrateDependency, DefWithBody, | ||
80 | Enum, EnumVariant, FieldSource, FnData, Function, HasBody, MacroDef, Module, ModuleDef, | ||
81 | ModuleSource, Static, Struct, StructField, Trait, TypeAlias, Union, | ||
82 | }; | ||
83 | |||
84 | pub use hir_def::{ | 83 | pub use hir_def::{ |
85 | either::Either, | ||
86 | name::Name, | 84 | name::Name, |
87 | path::{Path, PathKind}, | 85 | path::{Path, PathKind}, |
88 | type_ref::Mutability, | 86 | type_ref::Mutability, |
89 | }; | 87 | }; |
88 | pub use hir_expand::either::Either; | ||
diff --git a/crates/ra_hir_def/src/hygiene.rs b/crates/ra_hir_def/src/hygiene.rs index e1ae58a3b..f51c46fcb 100644 --- a/crates/ra_hir_def/src/hygiene.rs +++ b/crates/ra_hir_def/src/hygiene.rs | |||
@@ -4,14 +4,12 @@ | |||
4 | //! this moment, this is horribly incomplete and handles only `$crate`. | 4 | //! this moment, this is horribly incomplete and handles only `$crate`. |
5 | // Should this be moved to `hir_expand`? Seems like it. | 5 | // Should this be moved to `hir_expand`? Seems like it. |
6 | 6 | ||
7 | use hir_expand::either::Either; | ||
7 | use hir_expand::{db::AstDatabase, HirFileId}; | 8 | use hir_expand::{db::AstDatabase, HirFileId}; |
8 | use ra_db::CrateId; | 9 | use ra_db::CrateId; |
9 | use ra_syntax::ast; | 10 | use ra_syntax::ast; |
10 | 11 | ||
11 | use crate::{ | 12 | use crate::name::{AsName, Name}; |
12 | either::Either, | ||
13 | name::{AsName, Name}, | ||
14 | }; | ||
15 | 13 | ||
16 | #[derive(Debug)] | 14 | #[derive(Debug)] |
17 | pub struct Hygiene { | 15 | pub struct Hygiene { |
diff --git a/crates/ra_hir_def/src/lib.rs b/crates/ra_hir_def/src/lib.rs index 61ccdb30d..0de728dc1 100644 --- a/crates/ra_hir_def/src/lib.rs +++ b/crates/ra_hir_def/src/lib.rs | |||
@@ -8,7 +8,6 @@ | |||
8 | //! actually true. | 8 | //! actually true. |
9 | 9 | ||
10 | pub mod db; | 10 | pub mod db; |
11 | pub mod either; | ||
12 | pub mod attr; | 11 | pub mod attr; |
13 | pub mod name; | 12 | pub mod name; |
14 | pub mod path; | 13 | pub mod path; |
diff --git a/crates/ra_hir_def/src/nameres/raw.rs b/crates/ra_hir_def/src/nameres/raw.rs index 636364628..f1896c0cc 100644 --- a/crates/ra_hir_def/src/nameres/raw.rs +++ b/crates/ra_hir_def/src/nameres/raw.rs | |||
@@ -2,7 +2,7 @@ | |||
2 | 2 | ||
3 | use std::{ops::Index, sync::Arc}; | 3 | use std::{ops::Index, sync::Arc}; |
4 | 4 | ||
5 | use hir_expand::{ast_id_map::AstIdMap, db::AstDatabase}; | 5 | use hir_expand::{ast_id_map::AstIdMap, db::AstDatabase, either::Either}; |
6 | use ra_arena::{impl_arena_id, map::ArenaMap, Arena, RawId}; | 6 | use ra_arena::{impl_arena_id, map::ArenaMap, Arena, RawId}; |
7 | use ra_syntax::{ | 7 | use ra_syntax::{ |
8 | ast::{self, AttrsOwner, NameOwner}, | 8 | ast::{self, AttrsOwner, NameOwner}, |
@@ -12,7 +12,6 @@ use ra_syntax::{ | |||
12 | use crate::{ | 12 | use crate::{ |
13 | attr::Attr, | 13 | attr::Attr, |
14 | db::DefDatabase2, | 14 | db::DefDatabase2, |
15 | either::Either, | ||
16 | hygiene::Hygiene, | 15 | hygiene::Hygiene, |
17 | name::{AsName, Name}, | 16 | name::{AsName, Name}, |
18 | path::Path, | 17 | path::Path, |
@@ -41,10 +40,8 @@ pub struct ImportSourceMap { | |||
41 | type ImportSourcePtr = Either<AstPtr<ast::UseTree>, AstPtr<ast::ExternCrateItem>>; | 40 | type ImportSourcePtr = Either<AstPtr<ast::UseTree>, AstPtr<ast::ExternCrateItem>>; |
42 | type ImportSource = Either<ast::UseTree, ast::ExternCrateItem>; | 41 | type ImportSource = Either<ast::UseTree, ast::ExternCrateItem>; |
43 | 42 | ||
44 | impl ImportSourcePtr { | 43 | fn to_node(ptr: ImportSourcePtr, file: &SourceFile) -> ImportSource { |
45 | fn to_node(self, file: &SourceFile) -> ImportSource { | 44 | ptr.map(|ptr| ptr.to_node(file.syntax()), |ptr| ptr.to_node(file.syntax())) |
46 | self.map(|ptr| ptr.to_node(file.syntax()), |ptr| ptr.to_node(file.syntax())) | ||
47 | } | ||
48 | } | 45 | } |
49 | 46 | ||
50 | impl ImportSourceMap { | 47 | impl ImportSourceMap { |
@@ -58,7 +55,7 @@ impl ImportSourceMap { | |||
58 | ModuleSource::Module(m) => m.syntax().ancestors().find_map(SourceFile::cast).unwrap(), | 55 | ModuleSource::Module(m) => m.syntax().ancestors().find_map(SourceFile::cast).unwrap(), |
59 | }; | 56 | }; |
60 | 57 | ||
61 | self.map[import].to_node(&file) | 58 | to_node(self.map[import], &file) |
62 | } | 59 | } |
63 | } | 60 | } |
64 | 61 | ||
diff --git a/crates/ra_hir_def/src/path.rs b/crates/ra_hir_def/src/path.rs index 39f394c3f..8d57e7761 100644 --- a/crates/ra_hir_def/src/path.rs +++ b/crates/ra_hir_def/src/path.rs | |||
@@ -2,6 +2,7 @@ | |||
2 | 2 | ||
3 | use std::{iter, sync::Arc}; | 3 | use std::{iter, sync::Arc}; |
4 | 4 | ||
5 | use hir_expand::either::Either; | ||
5 | use ra_db::CrateId; | 6 | use ra_db::CrateId; |
6 | use ra_syntax::{ | 7 | use ra_syntax::{ |
7 | ast::{self, NameOwner, TypeAscriptionOwner}, | 8 | ast::{self, NameOwner, TypeAscriptionOwner}, |
@@ -9,7 +10,6 @@ use ra_syntax::{ | |||
9 | }; | 10 | }; |
10 | 11 | ||
11 | use crate::{ | 12 | use crate::{ |
12 | either::Either, | ||
13 | hygiene::Hygiene, | 13 | hygiene::Hygiene, |
14 | name::{self, AsName, Name}, | 14 | name::{self, AsName, Name}, |
15 | type_ref::TypeRef, | 15 | type_ref::TypeRef, |
diff --git a/crates/ra_hir_def/src/either.rs b/crates/ra_hir_expand/src/either.rs index 83583ef8b..83583ef8b 100644 --- a/crates/ra_hir_def/src/either.rs +++ b/crates/ra_hir_expand/src/either.rs | |||
diff --git a/crates/ra_hir_expand/src/lib.rs b/crates/ra_hir_expand/src/lib.rs index 3c0ef8f1c..6359b2b4d 100644 --- a/crates/ra_hir_expand/src/lib.rs +++ b/crates/ra_hir_expand/src/lib.rs | |||
@@ -6,6 +6,7 @@ | |||
6 | 6 | ||
7 | pub mod db; | 7 | pub mod db; |
8 | pub mod ast_id_map; | 8 | pub mod ast_id_map; |
9 | pub mod either; | ||
9 | 10 | ||
10 | use std::hash::{Hash, Hasher}; | 11 | use std::hash::{Hash, Hasher}; |
11 | 12 | ||