aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/nameres.rs
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2019-01-09 12:20:05 +0000
committerbors[bot] <bors[bot]@users.noreply.github.com>2019-01-09 12:20:05 +0000
commit76b3985d70f850e22e6cc630230e56dd7cb96f9a (patch)
treed0d9586bcdf5d8efc1b7d031810ece7093c482d3 /crates/ra_hir/src/nameres.rs
parentc0f48f9eb091b5054acb98575c69c67a0aeefb7b (diff)
parent0b8fbb4fad97d2980f0070a23f5365a5ed887e2a (diff)
Merge #473
473: Partial typo fix r=matklad a=marcusklaas This fixes some typos. Mostly in documentation, but also some code is affected (`defenition` was used in a few method names). Co-authored-by: Marcus Klaas de Vries <[email protected]>
Diffstat (limited to 'crates/ra_hir/src/nameres.rs')
-rw-r--r--crates/ra_hir/src/nameres.rs24
1 files changed, 12 insertions, 12 deletions
diff --git a/crates/ra_hir/src/nameres.rs b/crates/ra_hir/src/nameres.rs
index 20adc9ec4..6bf949654 100644
--- a/crates/ra_hir/src/nameres.rs
+++ b/crates/ra_hir/src/nameres.rs
@@ -1,18 +1,18 @@
1//! Name resolution algorithm. The end result of the algorithm is `ItemMap`: a 1//! Name resolution algorithm. The end result of the algorithm is an `ItemMap`:
2//! map with maps each module to it's scope: the set of items, visible in the 2//! a map which maps each module to its scope: the set of items visible in the
3//! module. That is, we only resolve imports here, name resolution of item 3//! module. That is, we only resolve imports here, name resolution of item
4//! bodies will be done in a separate step. 4//! bodies will be done in a separate step.
5//! 5//!
6//! Like Rustc, we use an interative per-crate algorithm: we start with scopes 6//! Like Rustc, we use an interactive per-crate algorithm: we start with scopes
7//! containing only directly defined items, and then iteratively resolve 7//! containing only directly defined items, and then iteratively resolve
8//! imports. 8//! imports.
9//! 9//!
10//! To make this work nicely in the IDE scenarios, we place `InputModuleItems` 10//! To make this work nicely in the IDE scenario, we place `InputModuleItems`
11//! in between raw syntax and name resolution. `InputModuleItems` are computed 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 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 13//! imports. The plan is to make `InputModuleItems` independent of local
14//! modifications (that is, typing inside a function shold not change IMIs), 14//! modifications (that is, typing inside a function should not change IMIs),
15//! such that the results of name resolution can be preserved unless the module 15//! so that the results of name resolution can be preserved unless the module
16//! structure itself is modified. 16//! structure itself is modified.
17use std::sync::Arc; 17use std::sync::Arc;
18 18
@@ -34,7 +34,7 @@ use crate::{
34 module_tree::{ModuleId, ModuleTree}, 34 module_tree::{ModuleId, ModuleTree},
35}; 35};
36 36
37/// Item map is the result of the name resolution. Item map contains, for each 37/// `ItemMap` is the result of name resolution. It contains, for each
38/// module, the set of visible items. 38/// module, the set of visible items.
39// FIXME: currenty we compute item map per source-root. We should do it per crate instead. 39// FIXME: currenty we compute item map per source-root. We should do it per crate instead.
40#[derive(Default, Debug, PartialEq, Eq)] 40#[derive(Default, Debug, PartialEq, Eq)]
@@ -59,9 +59,9 @@ impl ModuleScope {
59/// A set of items and imports declared inside a module, without relation to 59/// A set of items and imports declared inside a module, without relation to
60/// other modules. 60/// other modules.
61/// 61///
62/// This stands in-between raw syntax and name resolution and alow us to avoid 62/// This sits in-between raw syntax and name resolution and allows us to avoid
63/// recomputing name res: if `InputModuleItems` are the same, we can avoid 63/// recomputing name res: if two instance of `InputModuleItems` are the same, we
64/// running name resolution. 64/// can avoid redoing name resolution.
65#[derive(Debug, Default, PartialEq, Eq)] 65#[derive(Debug, Default, PartialEq, Eq)]
66pub struct InputModuleItems { 66pub struct InputModuleItems {
67 pub(crate) items: Vec<ModuleItem>, 67 pub(crate) items: Vec<ModuleItem>,
@@ -114,7 +114,7 @@ enum ImportKind {
114 Named(NamedImport), 114 Named(NamedImport),
115} 115}
116 116
117/// Resolution is basically `DefId` atm, but it should account for stuff like 117/// `Resolution` is basically `DefId` atm, but it should account for stuff like
118/// multiple namespaces, ambiguity and errors. 118/// multiple namespaces, ambiguity and errors.
119#[derive(Debug, Clone, PartialEq, Eq)] 119#[derive(Debug, Clone, PartialEq, Eq)]
120pub struct Resolution { 120pub struct Resolution {