diff options
author | Aleksey Kladov <[email protected]> | 2018-11-27 18:45:42 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-11-27 18:45:42 +0000 |
commit | d659b7a2f03788eb0f4f15e3730bbf65a18ed818 (patch) | |
tree | c7112f1e0785606ab67b3df8d7a8b411909f54e1 | |
parent | 9f08341aa486ea59cb488635f19e960523568fb8 (diff) |
start descriptors -> hir rename
-rw-r--r-- | crates/ra_analysis/src/completion/mod.rs | 2 | ||||
-rw-r--r-- | crates/ra_analysis/src/completion/reference_completion.rs | 2 | ||||
-rw-r--r-- | crates/ra_analysis/src/db.rs | 20 | ||||
-rw-r--r-- | crates/ra_analysis/src/hir/function/imp.rs (renamed from crates/ra_analysis/src/descriptors/function/imp.rs) | 2 | ||||
-rw-r--r-- | crates/ra_analysis/src/hir/function/mod.rs (renamed from crates/ra_analysis/src/descriptors/function/mod.rs) | 0 | ||||
-rw-r--r-- | crates/ra_analysis/src/hir/function/scope.rs (renamed from crates/ra_analysis/src/descriptors/function/scope.rs) | 0 | ||||
-rw-r--r-- | crates/ra_analysis/src/hir/mod.rs (renamed from crates/ra_analysis/src/descriptors/mod.rs) | 11 | ||||
-rw-r--r-- | crates/ra_analysis/src/hir/module/imp.rs (renamed from crates/ra_analysis/src/descriptors/module/imp.rs) | 2 | ||||
-rw-r--r-- | crates/ra_analysis/src/hir/module/mod.rs (renamed from crates/ra_analysis/src/descriptors/module/mod.rs) | 2 | ||||
-rw-r--r-- | crates/ra_analysis/src/hir/module/nameres.rs (renamed from crates/ra_analysis/src/descriptors/module/nameres.rs) | 4 | ||||
-rw-r--r-- | crates/ra_analysis/src/hir/path.rs (renamed from crates/ra_analysis/src/descriptors/path.rs) | 0 | ||||
-rw-r--r-- | crates/ra_analysis/src/imp.rs | 4 | ||||
-rw-r--r-- | crates/ra_analysis/src/lib.rs | 8 | ||||
-rw-r--r-- | crates/ra_analysis/src/loc2id.rs | 4 |
14 files changed, 34 insertions, 27 deletions
diff --git a/crates/ra_analysis/src/completion/mod.rs b/crates/ra_analysis/src/completion/mod.rs index 5ef278127..1eb804c85 100644 --- a/crates/ra_analysis/src/completion/mod.rs +++ b/crates/ra_analysis/src/completion/mod.rs | |||
@@ -11,7 +11,7 @@ use rustc_hash::{FxHashMap}; | |||
11 | 11 | ||
12 | use crate::{ | 12 | use crate::{ |
13 | db::{self, SyntaxDatabase}, | 13 | db::{self, SyntaxDatabase}, |
14 | descriptors::{ | 14 | hir::{ |
15 | module::{ModuleDescriptor} | 15 | module::{ModuleDescriptor} |
16 | }, | 16 | }, |
17 | Cancelable, FilePosition | 17 | Cancelable, FilePosition |
diff --git a/crates/ra_analysis/src/completion/reference_completion.rs b/crates/ra_analysis/src/completion/reference_completion.rs index 858b52e76..ac6ef1d4a 100644 --- a/crates/ra_analysis/src/completion/reference_completion.rs +++ b/crates/ra_analysis/src/completion/reference_completion.rs | |||
@@ -10,7 +10,7 @@ use ra_syntax::{ | |||
10 | use crate::{ | 10 | use crate::{ |
11 | db::RootDatabase, | 11 | db::RootDatabase, |
12 | completion::CompletionItem, | 12 | completion::CompletionItem, |
13 | descriptors::{ | 13 | hir::{ |
14 | module::{ModuleDescriptor}, | 14 | module::{ModuleDescriptor}, |
15 | function::FnScopes, | 15 | function::FnScopes, |
16 | Def, | 16 | Def, |
diff --git a/crates/ra_analysis/src/db.rs b/crates/ra_analysis/src/db.rs index 4e34265fb..fa59b8b3e 100644 --- a/crates/ra_analysis/src/db.rs +++ b/crates/ra_analysis/src/db.rs | |||
@@ -7,7 +7,7 @@ use salsa::{self, Database}; | |||
7 | 7 | ||
8 | use crate::{ | 8 | use crate::{ |
9 | db, | 9 | db, |
10 | descriptors, | 10 | hir, |
11 | symbol_index::SymbolIndex, | 11 | symbol_index::SymbolIndex, |
12 | syntax_ptr::SyntaxPtr, | 12 | syntax_ptr::SyntaxPtr, |
13 | loc2id::{IdMaps, IdDatabase}, | 13 | loc2id::{IdMaps, IdDatabase}, |
@@ -122,15 +122,15 @@ salsa::database_storage! { | |||
122 | fn file_symbols() for FileSymbolsQuery; | 122 | fn file_symbols() for FileSymbolsQuery; |
123 | fn resolve_syntax_ptr() for ResolveSyntaxPtrQuery; | 123 | fn resolve_syntax_ptr() for ResolveSyntaxPtrQuery; |
124 | } | 124 | } |
125 | impl descriptors::DescriptorDatabase { | 125 | impl hir::DescriptorDatabase { |
126 | fn module_tree() for descriptors::ModuleTreeQuery; | 126 | fn module_tree() for hir::ModuleTreeQuery; |
127 | fn fn_scopes() for descriptors::FnScopesQuery; | 127 | fn fn_scopes() for hir::FnScopesQuery; |
128 | fn _file_items() for descriptors::FileItemsQuery; | 128 | fn _file_items() for hir::FileItemsQuery; |
129 | fn _file_item() for descriptors::FileItemQuery; | 129 | fn _file_item() for hir::FileItemQuery; |
130 | fn _input_module_items() for descriptors::InputModuleItemsQuery; | 130 | fn _input_module_items() for hir::InputModuleItemsQuery; |
131 | fn _item_map() for descriptors::ItemMapQuery; | 131 | fn _item_map() for hir::ItemMapQuery; |
132 | fn _fn_syntax() for descriptors::FnSyntaxQuery; | 132 | fn _fn_syntax() for hir::FnSyntaxQuery; |
133 | fn _submodules() for descriptors::SubmodulesQuery; | 133 | fn _submodules() for hir::SubmodulesQuery; |
134 | } | 134 | } |
135 | } | 135 | } |
136 | } | 136 | } |
diff --git a/crates/ra_analysis/src/descriptors/function/imp.rs b/crates/ra_analysis/src/hir/function/imp.rs index e09deba0f..cd573a47f 100644 --- a/crates/ra_analysis/src/descriptors/function/imp.rs +++ b/crates/ra_analysis/src/hir/function/imp.rs | |||
@@ -2,7 +2,7 @@ use std::sync::Arc; | |||
2 | 2 | ||
3 | use ra_syntax::ast::{AstNode, FnDef, FnDefNode}; | 3 | use ra_syntax::ast::{AstNode, FnDef, FnDefNode}; |
4 | 4 | ||
5 | use crate::descriptors::{ | 5 | use crate::hir::{ |
6 | function::{FnId, FnScopes}, | 6 | function::{FnId, FnScopes}, |
7 | DescriptorDatabase, | 7 | DescriptorDatabase, |
8 | }; | 8 | }; |
diff --git a/crates/ra_analysis/src/descriptors/function/mod.rs b/crates/ra_analysis/src/hir/function/mod.rs index 86eee5e93..86eee5e93 100644 --- a/crates/ra_analysis/src/descriptors/function/mod.rs +++ b/crates/ra_analysis/src/hir/function/mod.rs | |||
diff --git a/crates/ra_analysis/src/descriptors/function/scope.rs b/crates/ra_analysis/src/hir/function/scope.rs index 5307a0a8e..5307a0a8e 100644 --- a/crates/ra_analysis/src/descriptors/function/scope.rs +++ b/crates/ra_analysis/src/hir/function/scope.rs | |||
diff --git a/crates/ra_analysis/src/descriptors/mod.rs b/crates/ra_analysis/src/hir/mod.rs index 7a1bcf447..6bee2b5c4 100644 --- a/crates/ra_analysis/src/descriptors/mod.rs +++ b/crates/ra_analysis/src/hir/mod.rs | |||
@@ -1,3 +1,10 @@ | |||
1 | //! HIR (previsouly known as descriptors) provides a high-level OO acess to Rust | ||
2 | //! code. | ||
3 | //! | ||
4 | //! The principal difference between HIR and syntax trees is that HIR is bound | ||
5 | //! to a particular crate instance. That is, it has cfg flags and features | ||
6 | //! applied. So, there relation between syntax and HIR is many-to-one. | ||
7 | |||
1 | pub(crate) mod function; | 8 | pub(crate) mod function; |
2 | pub(crate) mod module; | 9 | pub(crate) mod module; |
3 | mod path; | 10 | mod path; |
@@ -12,8 +19,8 @@ use ra_syntax::{ | |||
12 | use crate::{ | 19 | use crate::{ |
13 | FileId, | 20 | FileId, |
14 | db::SyntaxDatabase, | 21 | db::SyntaxDatabase, |
15 | descriptors::function::{resolve_local_name, FnId, FnScopes}, | 22 | hir::function::{resolve_local_name, FnId, FnScopes}, |
16 | descriptors::module::{ | 23 | hir::module::{ |
17 | ModuleId, ModuleTree, ModuleSource, ModuleDescriptor, | 24 | ModuleId, ModuleTree, ModuleSource, ModuleDescriptor, |
18 | nameres::{ItemMap, InputModuleItems, FileItems} | 25 | nameres::{ItemMap, InputModuleItems, FileItems} |
19 | }, | 26 | }, |
diff --git a/crates/ra_analysis/src/descriptors/module/imp.rs b/crates/ra_analysis/src/hir/module/imp.rs index 80892acb7..d8539ed85 100644 --- a/crates/ra_analysis/src/descriptors/module/imp.rs +++ b/crates/ra_analysis/src/hir/module/imp.rs | |||
@@ -9,7 +9,7 @@ use rustc_hash::{FxHashMap, FxHashSet}; | |||
9 | 9 | ||
10 | use crate::{ | 10 | use crate::{ |
11 | db, | 11 | db, |
12 | descriptors::DescriptorDatabase, | 12 | hir::DescriptorDatabase, |
13 | input::{SourceRoot, SourceRootId}, | 13 | input::{SourceRoot, SourceRootId}, |
14 | Cancelable, FileId, FileResolverImp, | 14 | Cancelable, FileId, FileResolverImp, |
15 | }; | 15 | }; |
diff --git a/crates/ra_analysis/src/descriptors/module/mod.rs b/crates/ra_analysis/src/hir/module/mod.rs index 78911d5d9..f374a079f 100644 --- a/crates/ra_analysis/src/descriptors/module/mod.rs +++ b/crates/ra_analysis/src/hir/module/mod.rs | |||
@@ -14,7 +14,7 @@ use relative_path::RelativePathBuf; | |||
14 | 14 | ||
15 | use crate::{ | 15 | use crate::{ |
16 | db::SyntaxDatabase, syntax_ptr::SyntaxPtr, FileId, FilePosition, Cancelable, | 16 | db::SyntaxDatabase, syntax_ptr::SyntaxPtr, FileId, FilePosition, Cancelable, |
17 | descriptors::{Path, PathKind, DescriptorDatabase}, | 17 | hir::{Path, PathKind, DescriptorDatabase}, |
18 | input::SourceRootId, | 18 | input::SourceRootId, |
19 | arena::{Arena, Id}, | 19 | arena::{Arena, Id}, |
20 | loc2id::{DefLoc, DefId}, | 20 | loc2id::{DefLoc, DefId}, |
diff --git a/crates/ra_analysis/src/descriptors/module/nameres.rs b/crates/ra_analysis/src/hir/module/nameres.rs index d2964f67f..1ec85fbf2 100644 --- a/crates/ra_analysis/src/descriptors/module/nameres.rs +++ b/crates/ra_analysis/src/hir/module/nameres.rs | |||
@@ -31,7 +31,7 @@ use ra_syntax::{ | |||
31 | use crate::{ | 31 | use crate::{ |
32 | Cancelable, FileId, | 32 | Cancelable, FileId, |
33 | loc2id::{DefId, DefLoc}, | 33 | loc2id::{DefId, DefLoc}, |
34 | descriptors::{ | 34 | hir::{ |
35 | Path, PathKind, | 35 | Path, PathKind, |
36 | DescriptorDatabase, | 36 | DescriptorDatabase, |
37 | module::{ModuleId, ModuleTree, ModuleSourceNode}, | 37 | module::{ModuleId, ModuleTree, ModuleSourceNode}, |
@@ -447,7 +447,7 @@ mod tests { | |||
447 | use crate::{ | 447 | use crate::{ |
448 | AnalysisChange, | 448 | AnalysisChange, |
449 | mock_analysis::{MockAnalysis, analysis_and_position}, | 449 | mock_analysis::{MockAnalysis, analysis_and_position}, |
450 | descriptors::{DescriptorDatabase, module::ModuleDescriptor}, | 450 | hir::{DescriptorDatabase, module::ModuleDescriptor}, |
451 | input::FilesDatabase, | 451 | input::FilesDatabase, |
452 | }; | 452 | }; |
453 | use super::*; | 453 | use super::*; |
diff --git a/crates/ra_analysis/src/descriptors/path.rs b/crates/ra_analysis/src/hir/path.rs index 8279daf4b..8279daf4b 100644 --- a/crates/ra_analysis/src/descriptors/path.rs +++ b/crates/ra_analysis/src/hir/path.rs | |||
diff --git a/crates/ra_analysis/src/imp.rs b/crates/ra_analysis/src/imp.rs index 8a41b3152..8d60f9af7 100644 --- a/crates/ra_analysis/src/imp.rs +++ b/crates/ra_analysis/src/imp.rs | |||
@@ -19,7 +19,7 @@ use salsa::{Database, ParallelDatabase}; | |||
19 | use crate::{ | 19 | use crate::{ |
20 | completion::{completions, CompletionItem}, | 20 | completion::{completions, CompletionItem}, |
21 | db::{self, FileSyntaxQuery, SyntaxDatabase}, | 21 | db::{self, FileSyntaxQuery, SyntaxDatabase}, |
22 | descriptors::{ | 22 | hir::{ |
23 | function::{FnDescriptor, FnId}, | 23 | function::{FnDescriptor, FnId}, |
24 | module::{ModuleDescriptor, Problem}, | 24 | module::{ModuleDescriptor, Problem}, |
25 | DeclarationDescriptor, DescriptorDatabase, | 25 | DeclarationDescriptor, DescriptorDatabase, |
@@ -589,7 +589,7 @@ fn resolve_local_name( | |||
589 | let fn_def = name_ref.syntax().ancestors().find_map(ast::FnDef::cast)?; | 589 | let fn_def = name_ref.syntax().ancestors().find_map(ast::FnDef::cast)?; |
590 | let fn_id = FnId::get(db, file_id, fn_def); | 590 | let fn_id = FnId::get(db, file_id, fn_def); |
591 | let scopes = db.fn_scopes(fn_id); | 591 | let scopes = db.fn_scopes(fn_id); |
592 | let scope_entry = crate::descriptors::function::resolve_local_name(name_ref, &scopes)?; | 592 | let scope_entry = crate::hir::function::resolve_local_name(name_ref, &scopes)?; |
593 | let syntax = db.resolve_syntax_ptr(scope_entry.ptr().into_global(file_id)); | 593 | let syntax = db.resolve_syntax_ptr(scope_entry.ptr().into_global(file_id)); |
594 | Some((scope_entry.name().clone(), syntax.range())) | 594 | Some((scope_entry.name().clone(), syntax.range())) |
595 | } | 595 | } |
diff --git a/crates/ra_analysis/src/lib.rs b/crates/ra_analysis/src/lib.rs index 0fbfd8a40..4659eb523 100644 --- a/crates/ra_analysis/src/lib.rs +++ b/crates/ra_analysis/src/lib.rs | |||
@@ -19,14 +19,14 @@ macro_rules! ctry { | |||
19 | } | 19 | } |
20 | 20 | ||
21 | mod arena; | 21 | mod arena; |
22 | mod syntax_ptr; | ||
23 | mod input; | ||
22 | mod db; | 24 | mod db; |
23 | mod loc2id; | 25 | mod loc2id; |
24 | mod input; | ||
25 | mod imp; | 26 | mod imp; |
26 | mod completion; | 27 | mod completion; |
27 | mod descriptors; | 28 | mod hir; |
28 | mod symbol_index; | 29 | mod symbol_index; |
29 | mod syntax_ptr; | ||
30 | pub mod mock_analysis; | 30 | pub mod mock_analysis; |
31 | 31 | ||
32 | use std::{fmt, sync::Arc}; | 32 | use std::{fmt, sync::Arc}; |
@@ -42,7 +42,7 @@ use crate::{ | |||
42 | 42 | ||
43 | pub use crate::{ | 43 | pub use crate::{ |
44 | completion::CompletionItem, | 44 | completion::CompletionItem, |
45 | descriptors::function::FnDescriptor, | 45 | hir::function::FnDescriptor, |
46 | input::{CrateGraph, CrateId, FileId, FileResolver}, | 46 | input::{CrateGraph, CrateId, FileId, FileResolver}, |
47 | }; | 47 | }; |
48 | pub use ra_editor::{ | 48 | pub use ra_editor::{ |
diff --git a/crates/ra_analysis/src/loc2id.rs b/crates/ra_analysis/src/loc2id.rs index c7c799a91..d42af4e0a 100644 --- a/crates/ra_analysis/src/loc2id.rs +++ b/crates/ra_analysis/src/loc2id.rs | |||
@@ -9,8 +9,8 @@ use rustc_hash::FxHashMap; | |||
9 | 9 | ||
10 | use crate::{ | 10 | use crate::{ |
11 | FileId, | 11 | FileId, |
12 | descriptors::FileItemId, | 12 | hir::FileItemId, |
13 | descriptors::module::ModuleId, | 13 | hir::module::ModuleId, |
14 | syntax_ptr::SyntaxPtr, | 14 | syntax_ptr::SyntaxPtr, |
15 | input::SourceRootId, | 15 | input::SourceRootId, |
16 | }; | 16 | }; |