aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/ra_hir/src/nameres.rs24
1 files changed, 15 insertions, 9 deletions
diff --git a/crates/ra_hir/src/nameres.rs b/crates/ra_hir/src/nameres.rs
index 17602ee6b..edd2f25f7 100644
--- a/crates/ra_hir/src/nameres.rs
+++ b/crates/ra_hir/src/nameres.rs
@@ -10,12 +10,12 @@
10/// 10///
11/// Computing `CrateDefMap` can be partitioned into several logically 11/// Computing `CrateDefMap` can be partitioned into several logically
12/// independent "phases". The phases are mutually recursive though, there's no 12/// independent "phases". The phases are mutually recursive though, there's no
13/// stric ordering. 13/// strict ordering.
14/// 14///
15/// ## Collecting RawItems 15/// ## Collecting RawItems
16/// 16///
17/// This happens in the `raw` module, which parses a single source file into a 17/// This happens in the `raw` module, which parses a single source file into a
18/// set of top-level items. Nested importa are desugared to flat imports in 18/// set of top-level items. Nested imports are desugared to flat imports in
19/// this phase. Macro calls are represented as a triple of (Path, Option<Name>, 19/// this phase. Macro calls are represented as a triple of (Path, Option<Name>,
20/// TokenTree). 20/// TokenTree).
21/// 21///
@@ -24,22 +24,28 @@
24/// This happens in the `collector` module. In this phase, we recursively walk 24/// This happens in the `collector` module. In this phase, we recursively walk
25/// tree of modules, collect raw items from submodules, populate module scopes 25/// tree of modules, collect raw items from submodules, populate module scopes
26/// with defined items (so, we assign item ids in this phase) and record the set 26/// with defined items (so, we assign item ids in this phase) and record the set
27/// of unresovled imports and macros. 27/// of unresolved imports and macros.
28/// 28///
29/// While we walk tree of modules, we also record macro_rules defenitions and 29/// While we walk tree of modules, we also record macro_rules definitions and
30/// expand calls to macro_rules defined macros. 30/// expand calls to macro_rules defined macros.
31/// 31///
32/// ## Resolving Imports 32/// ## Resolving Imports
33/// 33///
34/// TBD 34/// We maintain a list of currently unresolved imports. On every iteration, we
35/// try to resolve some imports from this list. If the import is resolved, we
36/// record it, by adding an item to current module scope and, if necessary, by
37/// recursively populating glob imports.
35/// 38///
36/// ## Resolving Macros 39/// ## Resolving Macros
37/// 40///
38/// While macro_rules from the same crate use a global mutable namespace, macros 41/// macro_rules from the same crate use a global mutable namespace. We expand
39/// from other crates (including proc-macros) can be used with `foo::bar!` 42/// them immediately, when we collect modules.
40/// syntax.
41/// 43///
42/// TBD; 44/// Macros from other crates (including proc-macros) can be used with
45/// `foo::bar!` syntax. We handle them similarly to imports. There's a list of
46/// unexpanded macros. On every iteration, we try to resolve each macro call
47/// path and, upon success, we run macro expansion and "collect module" phase
48/// on the result
43 49
44mod per_ns; 50mod per_ns;
45mod raw; 51mod raw;