diff options
author | Aleksey Kladov <[email protected]> | 2018-11-21 14:07:44 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-11-21 14:07:44 +0000 |
commit | 18000ba864cd076141778fd692b3853716adb683 (patch) | |
tree | 2fada73343cfeeed35c306683fcbb653197771c2 | |
parent | d47075af5275bcf4f22b9c8ab00027f7828d640d (diff) |
docs
-rw-r--r-- | crates/ra_analysis/src/descriptors/module/nameres.rs | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/crates/ra_analysis/src/descriptors/module/nameres.rs b/crates/ra_analysis/src/descriptors/module/nameres.rs index 16f1bbd1e..526e42af3 100644 --- a/crates/ra_analysis/src/descriptors/module/nameres.rs +++ b/crates/ra_analysis/src/descriptors/module/nameres.rs | |||
@@ -1,4 +1,19 @@ | |||
1 | //! Name resolution algorithm | 1 | //! Name resolution algorithm. The end result of the algorithm is `ItemMap`: a |
2 | //! map with maps each module to it's scope: the set of items, visible in the | ||
3 | //! module. That is, we only resolve imports here, name resolution of item | ||
4 | //! bodies will be done in a separate step. | ||
5 | //! | ||
6 | //! Like Rustc, we use an interative per-crate algorithm: we start with scopes | ||
7 | //! containing only directly defined items, and then iteratively resolve | ||
8 | //! imports. | ||
9 | //! | ||
10 | //! To make this work nicely in the IDE scenarios, we place `InputModuleItems` | ||
11 | //! in between raw syntax and name resolution. `InputModuleItems` are computed | ||
12 | //! using only the module's syntax, and it is all directly defined items plus | ||
13 | //! imports. The plain is to make `InputModuleItems` independent of local | ||
14 | //! modifications (that is, typing inside a function shold not change IMIs), | ||
15 | //! such that the results of name resolution can be preserved unless the module | ||
16 | //! structure itself is modified. | ||
2 | use std::{ | 17 | use std::{ |
3 | sync::Arc, | 18 | sync::Arc, |
4 | time::Instant, | 19 | time::Instant, |