From b6809b6695f9c4cec82ff98d73f7ff24f96cbecf Mon Sep 17 00:00:00 2001 From: Aleksey Kladov <aleksey.kladov@gmail.com> Date: Thu, 11 Apr 2019 15:51:02 +0300 Subject: rename --- crates/ra_assists/src/add_explicit_type.rs | 2 +- crates/ra_assists/src/add_missing_impl_members.rs | 6 +++--- crates/ra_assists/src/fill_match_arms.rs | 2 +- crates/ra_assists/src/fill_struct_fields.rs | 2 +- crates/ra_hir/src/lib.rs | 2 +- crates/ra_hir/src/source_binder.rs | 12 ++++++------ crates/ra_ide_api/src/call_info.rs | 2 +- crates/ra_ide_api/src/completion/completion_context.rs | 4 ++-- crates/ra_ide_api/src/goto_definition.rs | 2 +- crates/ra_ide_api/src/hover.rs | 2 +- 10 files changed, 18 insertions(+), 18 deletions(-) (limited to 'crates') diff --git a/crates/ra_assists/src/add_explicit_type.rs b/crates/ra_assists/src/add_explicit_type.rs index c50db4e21..c3674ffdc 100644 --- a/crates/ra_assists/src/add_explicit_type.rs +++ b/crates/ra_assists/src/add_explicit_type.rs @@ -29,7 +29,7 @@ pub(crate) fn add_explicit_type(mut ctx: AssistCtx<impl HirDatabase>) -> Option< } // Infer type let db = ctx.db; - let analyzer = hir::SourceAnalyser::new(db, ctx.frange.file_id, stmt.syntax()); + let analyzer = hir::SourceAnalyzer::new(db, ctx.frange.file_id, stmt.syntax()); let ty = analyzer.type_of(db, expr)?; // Assist not applicable if the type is unknown if is_unknown(&ty) { diff --git a/crates/ra_assists/src/add_missing_impl_members.rs b/crates/ra_assists/src/add_missing_impl_members.rs index 0b2127e11..04b3f3c76 100644 --- a/crates/ra_assists/src/add_missing_impl_members.rs +++ b/crates/ra_assists/src/add_missing_impl_members.rs @@ -45,7 +45,7 @@ fn add_missing_impl_members_inner( let trait_def = { let file_id = ctx.frange.file_id; let position = FilePosition { file_id, offset: impl_node.syntax().range().start() }; - let analyser = hir::SourceAnalyser::new(ctx.db, position.file_id, impl_node.syntax()); + let analyser = hir::SourceAnalyzer::new(ctx.db, position.file_id, impl_node.syntax()); resolve_target_trait_def(ctx.db, &analyser, impl_node)? }; @@ -121,13 +121,13 @@ fn add_missing_impl_members_inner( /// implemented) to a `ast::TraitDef`. fn resolve_target_trait_def( db: &impl HirDatabase, - binder: &hir::SourceAnalyser, + analyzer: &hir::SourceAnalyzer, impl_block: &ast::ImplBlock, ) -> Option<TreeArc<ast::TraitDef>> { let ast_path = impl_block.target_trait().map(AstNode::syntax).and_then(ast::PathType::cast)?.path()?; - match binder.resolve_path(db, &ast_path) { + match analyzer.resolve_path(db, &ast_path) { Some(hir::PathResolution::Def(hir::ModuleDef::Trait(def))) => Some(def.source(db).1), _ => None, } diff --git a/crates/ra_assists/src/fill_match_arms.rs b/crates/ra_assists/src/fill_match_arms.rs index 050b1c73f..8110b2676 100644 --- a/crates/ra_assists/src/fill_match_arms.rs +++ b/crates/ra_assists/src/fill_match_arms.rs @@ -20,7 +20,7 @@ pub(crate) fn fill_match_arms(mut ctx: AssistCtx<impl HirDatabase>) -> Option<As } let expr = match_expr.expr()?; - let analyzer = hir::SourceAnalyser::new(ctx.db, ctx.frange.file_id, expr.syntax()); + let analyzer = hir::SourceAnalyzer::new(ctx.db, ctx.frange.file_id, expr.syntax()); let match_expr_ty = analyzer.type_of(ctx.db, expr)?; let enum_def = match_expr_ty.autoderef(ctx.db).find_map(|ty| match ty.as_adt() { Some((AdtDef::Enum(e), _)) => Some(e), diff --git a/crates/ra_assists/src/fill_struct_fields.rs b/crates/ra_assists/src/fill_struct_fields.rs index e23cccbb8..81f762e8d 100644 --- a/crates/ra_assists/src/fill_struct_fields.rs +++ b/crates/ra_assists/src/fill_struct_fields.rs @@ -51,7 +51,7 @@ where } fn evaluate_struct_def_fields(&mut self) -> Option<()> { - let analyzer = hir::SourceAnalyser::new( + let analyzer = hir::SourceAnalyzer::new( self.ctx.db, self.ctx.frange.file_id, self.struct_lit.syntax(), diff --git a/crates/ra_hir/src/lib.rs b/crates/ra_hir/src/lib.rs index 8702c6222..3ca810a8b 100644 --- a/crates/ra_hir/src/lib.rs +++ b/crates/ra_hir/src/lib.rs @@ -66,7 +66,7 @@ pub use self::{ adt::AdtDef, expr::{ExprScopes, ScopesWithSourceMap, ScopeEntryWithSyntax}, resolve::{Resolver, Resolution}, - source_binder::{SourceAnalyser, PathResolution}, + source_binder::{SourceAnalyzer, PathResolution}, }; pub use self::code_model_api::{ diff --git a/crates/ra_hir/src/source_binder.rs b/crates/ra_hir/src/source_binder.rs index 79e304383..309e33ca9 100644 --- a/crates/ra_hir/src/source_binder.rs +++ b/crates/ra_hir/src/source_binder.rs @@ -261,9 +261,9 @@ fn try_get_resolver_for_node( } } -// Name is bad, don't use inside HIR +/// `SourceAnalyzer` #[derive(Debug)] -pub struct SourceAnalyser { +pub struct SourceAnalyzer { resolver: Resolver, body_source_map: Option<Arc<crate::expr::BodySourceMap>>, infer: Option<Arc<crate::ty::InferenceResult>>, @@ -281,18 +281,18 @@ pub enum PathResolution { AssocItem(crate::ImplItem), } -impl SourceAnalyser { - pub fn new(db: &impl HirDatabase, file_id: FileId, node: &SyntaxNode) -> SourceAnalyser { +impl SourceAnalyzer { + pub fn new(db: &impl HirDatabase, file_id: FileId, node: &SyntaxNode) -> SourceAnalyzer { let resolver = resolver_for_node(db, file_id, node); let function = function_from_child_node(db, file_id, node); if let Some(function) = function { - SourceAnalyser { + SourceAnalyzer { resolver, body_source_map: Some(function.body_source_map(db)), infer: Some(function.infer(db)), } } else { - SourceAnalyser { resolver, body_source_map: None, infer: None } + SourceAnalyzer { resolver, body_source_map: None, infer: None } } } diff --git a/crates/ra_ide_api/src/call_info.rs b/crates/ra_ide_api/src/call_info.rs index 1f1d05409..a6676cad5 100644 --- a/crates/ra_ide_api/src/call_info.rs +++ b/crates/ra_ide_api/src/call_info.rs @@ -17,7 +17,7 @@ pub(crate) fn call_info(db: &RootDatabase, position: FilePosition) -> Option<Cal let calling_node = FnCallNode::with_node(syntax, position.offset)?; let name_ref = calling_node.name_ref()?; - let analyser = hir::SourceAnalyser::new(db, position.file_id, name_ref.syntax()); + let analyser = hir::SourceAnalyzer::new(db, position.file_id, name_ref.syntax()); let function = match calling_node { FnCallNode::CallExpr(expr) => { //FIXME: apply subst diff --git a/crates/ra_ide_api/src/completion/completion_context.rs b/crates/ra_ide_api/src/completion/completion_context.rs index ddcf46b4e..98cdccef7 100644 --- a/crates/ra_ide_api/src/completion/completion_context.rs +++ b/crates/ra_ide_api/src/completion/completion_context.rs @@ -14,7 +14,7 @@ use crate::{db, FilePosition}; #[derive(Debug)] pub(crate) struct CompletionContext<'a> { pub(super) db: &'a db::RootDatabase, - pub(super) analyzer: hir::SourceAnalyser, + pub(super) analyzer: hir::SourceAnalyzer, pub(super) offset: TextUnit, pub(super) token: SyntaxToken<'a>, pub(super) resolver: Resolver, @@ -50,7 +50,7 @@ impl<'a> CompletionContext<'a> { let resolver = source_binder::resolver_for_position(db, position); let module = source_binder::module_from_position(db, position); let token = find_token_at_offset(original_file.syntax(), position.offset).left_biased()?; - let analyzer = hir::SourceAnalyser::new(db, position.file_id, token.parent()); + let analyzer = hir::SourceAnalyzer::new(db, position.file_id, token.parent()); let mut ctx = CompletionContext { db, analyzer, diff --git a/crates/ra_ide_api/src/goto_definition.rs b/crates/ra_ide_api/src/goto_definition.rs index 7f93f50c4..1f1a8d126 100644 --- a/crates/ra_ide_api/src/goto_definition.rs +++ b/crates/ra_ide_api/src/goto_definition.rs @@ -47,7 +47,7 @@ pub(crate) fn reference_definition( ) -> ReferenceResult { use self::ReferenceResult::*; - let analyzer = hir::SourceAnalyser::new(db, file_id, name_ref.syntax()); + let analyzer = hir::SourceAnalyzer::new(db, file_id, name_ref.syntax()); // Special cases: diff --git a/crates/ra_ide_api/src/hover.rs b/crates/ra_ide_api/src/hover.rs index ec167a196..0cba5a665 100644 --- a/crates/ra_ide_api/src/hover.rs +++ b/crates/ra_ide_api/src/hover.rs @@ -132,7 +132,7 @@ pub(crate) fn type_of(db: &RootDatabase, frange: FileRange) -> Option<String> { .ancestors() .take_while(|it| it.range() == leaf_node.range()) .find(|&it| ast::Expr::cast(it).is_some() || ast::Pat::cast(it).is_some())?; - let analyzer = hir::SourceAnalyser::new(db, frange.file_id, node); + let analyzer = hir::SourceAnalyzer::new(db, frange.file_id, node); let ty = if let Some(ty) = ast::Expr::cast(node).and_then(|e| analyzer.type_of(db, e)) { ty } else if let Some(ty) = ast::Pat::cast(node).and_then(|p| analyzer.type_of_pat(db, p)) { -- cgit v1.2.3