aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/expr
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/ra_hir/src/expr
parentca957edf96199c61496254f8534fe09221e03c26 (diff)
rename scopes
Diffstat (limited to 'crates/ra_hir/src/expr')
-rw-r--r--crates/ra_hir/src/expr/scope.rs8
1 files changed, 4 insertions, 4 deletions
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());