aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-03-02 13:38:28 +0000
committerAleksey Kladov <[email protected]>2019-03-02 13:38:28 +0000
commitfe5574b05a006671fb7dec44d8d6edc92c90b002 (patch)
treef13ce58c0718dcf4ade76bcf70ea854463e80825 /crates
parentca957edf96199c61496254f8534fe09221e03c26 (diff)
rename scopes
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_hir/src/code_model_api.rs6
-rw-r--r--crates/ra_hir/src/expr.rs2
-rw-r--r--crates/ra_hir/src/expr/scope.rs8
-rw-r--r--crates/ra_hir/src/lib.rs2
4 files changed, 9 insertions, 9 deletions
diff --git a/crates/ra_hir/src/code_model_api.rs b/crates/ra_hir/src/code_model_api.rs
index 7fc14634b..e362cc05f 100644
--- a/crates/ra_hir/src/code_model_api.rs
+++ b/crates/ra_hir/src/code_model_api.rs
@@ -5,7 +5,7 @@ use ra_db::{CrateId, SourceRootId, Edition};
5use ra_syntax::{ast::self, TreeArc, SyntaxNode}; 5use ra_syntax::{ast::self, TreeArc, SyntaxNode};
6 6
7use crate::{ 7use crate::{
8 Name, ScopesWithSyntaxMapping, Ty, HirFileId, 8 Name, ScopesWithSourceMap, Ty, HirFileId,
9 HirDatabase, PersistentHirDatabase, 9 HirDatabase, PersistentHirDatabase,
10 type_ref::TypeRef, 10 type_ref::TypeRef,
11 nameres::{ModuleScope, Namespace, lower::ImportId}, 11 nameres::{ModuleScope, Namespace, lower::ImportId},
@@ -495,10 +495,10 @@ impl Function {
495 db.type_for_def((*self).into(), Namespace::Values) 495 db.type_for_def((*self).into(), Namespace::Values)
496 } 496 }
497 497
498 pub fn scopes(&self, db: &impl HirDatabase) -> ScopesWithSyntaxMapping { 498 pub fn scopes(&self, db: &impl HirDatabase) -> ScopesWithSourceMap {
499 let scopes = db.expr_scopes(*self); 499 let scopes = db.expr_scopes(*self);
500 let source_map = db.body_with_source_map(*self).1; 500 let source_map = db.body_with_source_map(*self).1;
501 ScopesWithSyntaxMapping { scopes, source_map } 501 ScopesWithSourceMap { scopes, source_map }
502 } 502 }
503 503
504 pub fn signature(&self, db: &impl HirDatabase) -> Arc<FnSignature> { 504 pub fn signature(&self, db: &impl HirDatabase) -> Arc<FnSignature> {
diff --git a/crates/ra_hir/src/expr.rs b/crates/ra_hir/src/expr.rs
index 4e399ec6d..8b1079648 100644
--- a/crates/ra_hir/src/expr.rs
+++ b/crates/ra_hir/src/expr.rs
@@ -16,7 +16,7 @@ use crate::{
16}; 16};
17use crate::{ path::GenericArgs, ty::primitive::{UintTy, UncertainIntTy, UncertainFloatTy}}; 17use crate::{ path::GenericArgs, ty::primitive::{UintTy, UncertainIntTy, UncertainFloatTy}};
18 18
19pub use self::scope::{ExprScopes, ScopesWithSyntaxMapping, ScopeEntryWithSyntax}; 19pub use self::scope::{ExprScopes, ScopesWithSourceMap, ScopeEntryWithSyntax};
20 20
21pub(crate) mod scope; 21pub(crate) mod scope;
22 22
diff --git a/crates/ra_hir/src/expr/scope.rs b/crates/ra_hir/src/expr/scope.rs
index 578b10c65..81fbc509e 100644
--- a/crates/ra_hir/src/expr/scope.rs
+++ b/crates/ra_hir/src/expr/scope.rs
@@ -108,7 +108,7 @@ impl ExprScopes {
108} 108}
109 109
110#[derive(Debug, Clone, PartialEq, Eq)] 110#[derive(Debug, Clone, PartialEq, Eq)]
111pub struct ScopesWithSyntaxMapping { 111pub struct ScopesWithSourceMap {
112 pub source_map: Arc<BodySourceMap>, 112 pub source_map: Arc<BodySourceMap>,
113 pub scopes: Arc<ExprScopes>, 113 pub scopes: Arc<ExprScopes>,
114} 114}
@@ -129,7 +129,7 @@ impl ScopeEntryWithSyntax {
129 } 129 }
130} 130}
131 131
132impl ScopesWithSyntaxMapping { 132impl ScopesWithSourceMap {
133 fn scope_chain<'a>(&'a self, node: &SyntaxNode) -> impl Iterator<Item = ScopeId> + 'a { 133 fn scope_chain<'a>(&'a self, node: &SyntaxNode) -> impl Iterator<Item = ScopeId> + 'a {
134 generate(self.scope_for(node), move |&scope| self.scopes.scopes[scope].parent) 134 generate(self.scope_for(node), move |&scope| self.scopes.scopes[scope].parent)
135 } 135 }
@@ -319,7 +319,7 @@ mod tests {
319 let (body, source_map) = expr::collect_fn_body_syntax(irrelevant_function, fn_def); 319 let (body, source_map) = expr::collect_fn_body_syntax(irrelevant_function, fn_def);
320 let scopes = ExprScopes::new(Arc::new(body)); 320 let scopes = ExprScopes::new(Arc::new(body));
321 let scopes = 321 let scopes =
322 ScopesWithSyntaxMapping { scopes: Arc::new(scopes), source_map: Arc::new(source_map) }; 322 ScopesWithSourceMap { scopes: Arc::new(scopes), source_map: Arc::new(source_map) };
323 let actual = scopes 323 let actual = scopes
324 .scope_chain(marker.syntax()) 324 .scope_chain(marker.syntax())
325 .flat_map(|scope| scopes.scopes.entries(scope)) 325 .flat_map(|scope| scopes.scopes.entries(scope))
@@ -418,7 +418,7 @@ mod tests {
418 let (body, source_map) = expr::collect_fn_body_syntax(irrelevant_function, fn_def); 418 let (body, source_map) = expr::collect_fn_body_syntax(irrelevant_function, fn_def);
419 let scopes = ExprScopes::new(Arc::new(body)); 419 let scopes = ExprScopes::new(Arc::new(body));
420 let scopes = 420 let scopes =
421 ScopesWithSyntaxMapping { scopes: Arc::new(scopes), source_map: Arc::new(source_map) }; 421 ScopesWithSourceMap { scopes: Arc::new(scopes), source_map: Arc::new(source_map) };
422 let local_name_entry = scopes.resolve_local_name(name_ref).unwrap(); 422 let local_name_entry = scopes.resolve_local_name(name_ref).unwrap();
423 let local_name = local_name_entry.ptr(); 423 let local_name = local_name_entry.ptr();
424 assert_eq!(local_name.range(), expected_name.syntax().range()); 424 assert_eq!(local_name.range(), expected_name.syntax().range());
diff --git a/crates/ra_hir/src/lib.rs b/crates/ra_hir/src/lib.rs
index edc1b4f57..a6e744ea7 100644
--- a/crates/ra_hir/src/lib.rs
+++ b/crates/ra_hir/src/lib.rs
@@ -60,7 +60,7 @@ pub use self::{
60 impl_block::{ImplBlock, ImplItem}, 60 impl_block::{ImplBlock, ImplItem},
61 docs::{Docs, Documentation}, 61 docs::{Docs, Documentation},
62 adt::AdtDef, 62 adt::AdtDef,
63 expr::{ExprScopes, ScopesWithSyntaxMapping, ScopeEntryWithSyntax}, 63 expr::{ExprScopes, ScopesWithSourceMap, ScopeEntryWithSyntax},
64 resolve::{Resolver, Resolution}, 64 resolve::{Resolver, Resolution},
65}; 65};
66 66