From fe5574b05a006671fb7dec44d8d6edc92c90b002 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 2 Mar 2019 16:38:28 +0300 Subject: [PATCH] rename scopes --- crates/ra_hir/src/code_model_api.rs | 6 +++--- crates/ra_hir/src/expr.rs | 2 +- crates/ra_hir/src/expr/scope.rs | 8 ++++---- crates/ra_hir/src/lib.rs | 2 +- 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 7fc14634bcf..e362cc05f23 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_syntax::{ast::self, TreeArc, SyntaxNode}; use crate::{ - Name, ScopesWithSyntaxMapping, Ty, HirFileId, + Name, ScopesWithSourceMap, Ty, HirFileId, HirDatabase, PersistentHirDatabase, type_ref::TypeRef, nameres::{ModuleScope, Namespace, lower::ImportId}, @@ -495,10 +495,10 @@ pub fn ty(&self, db: &impl HirDatabase) -> Ty { db.type_for_def((*self).into(), Namespace::Values) } - pub fn scopes(&self, db: &impl HirDatabase) -> ScopesWithSyntaxMapping { + pub fn scopes(&self, db: &impl HirDatabase) -> ScopesWithSourceMap { let scopes = db.expr_scopes(*self); let source_map = db.body_with_source_map(*self).1; - ScopesWithSyntaxMapping { scopes, source_map } + ScopesWithSourceMap { scopes, source_map } } pub fn signature(&self, db: &impl HirDatabase) -> Arc { diff --git a/crates/ra_hir/src/expr.rs b/crates/ra_hir/src/expr.rs index 4e399ec6d1b..8b1079648ab 100644 --- a/crates/ra_hir/src/expr.rs +++ b/crates/ra_hir/src/expr.rs @@ -16,7 +16,7 @@ }; use crate::{ path::GenericArgs, ty::primitive::{UintTy, UncertainIntTy, UncertainFloatTy}}; -pub use self::scope::{ExprScopes, ScopesWithSyntaxMapping, ScopeEntryWithSyntax}; +pub use self::scope::{ExprScopes, ScopesWithSourceMap, ScopeEntryWithSyntax}; pub(crate) mod scope; diff --git a/crates/ra_hir/src/expr/scope.rs b/crates/ra_hir/src/expr/scope.rs index 578b10c651e..81fbc509eb5 100644 --- a/crates/ra_hir/src/expr/scope.rs +++ b/crates/ra_hir/src/expr/scope.rs @@ -108,7 +108,7 @@ pub fn scope_for(&self, expr: ExprId) -> Option { } #[derive(Debug, Clone, PartialEq, Eq)] -pub struct ScopesWithSyntaxMapping { +pub struct ScopesWithSourceMap { pub source_map: Arc, pub scopes: Arc, } @@ -129,7 +129,7 @@ pub fn ptr(&self) -> SyntaxNodePtr { } } -impl ScopesWithSyntaxMapping { +impl ScopesWithSourceMap { fn scope_chain<'a>(&'a self, node: &SyntaxNode) -> impl Iterator + 'a { generate(self.scope_for(node), move |&scope| self.scopes.scopes[scope].parent) } @@ -319,7 +319,7 @@ fn do_check(code: &str, expected: &[&str]) { let (body, source_map) = expr::collect_fn_body_syntax(irrelevant_function, fn_def); let scopes = ExprScopes::new(Arc::new(body)); let scopes = - ScopesWithSyntaxMapping { scopes: Arc::new(scopes), source_map: Arc::new(source_map) }; + ScopesWithSourceMap { scopes: Arc::new(scopes), source_map: Arc::new(source_map) }; let actual = scopes .scope_chain(marker.syntax()) .flat_map(|scope| scopes.scopes.entries(scope)) @@ -418,7 +418,7 @@ fn do_check_local_name(code: &str, expected_offset: u32) { let (body, source_map) = expr::collect_fn_body_syntax(irrelevant_function, fn_def); let scopes = ExprScopes::new(Arc::new(body)); let scopes = - ScopesWithSyntaxMapping { scopes: Arc::new(scopes), source_map: Arc::new(source_map) }; + ScopesWithSourceMap { scopes: Arc::new(scopes), source_map: Arc::new(source_map) }; let local_name_entry = scopes.resolve_local_name(name_ref).unwrap(); let local_name = local_name_entry.ptr(); 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 edc1b4f5747..a6e744ea70e 100644 --- a/crates/ra_hir/src/lib.rs +++ b/crates/ra_hir/src/lib.rs @@ -60,7 +60,7 @@ fn from(it: $v) -> $e { impl_block::{ImplBlock, ImplItem}, docs::{Docs, Documentation}, adt::AdtDef, - expr::{ExprScopes, ScopesWithSyntaxMapping, ScopeEntryWithSyntax}, + expr::{ExprScopes, ScopesWithSourceMap, ScopeEntryWithSyntax}, resolve::{Resolver, Resolution}, };