diff options
Diffstat (limited to 'crates')
-rw-r--r-- | crates/ra_assists/src/add_explicit_type.rs | 2 | ||||
-rw-r--r-- | crates/ra_assists/src/add_missing_impl_members.rs | 6 | ||||
-rw-r--r-- | crates/ra_assists/src/fill_match_arms.rs | 2 | ||||
-rw-r--r-- | crates/ra_assists/src/fill_struct_fields.rs | 2 | ||||
-rw-r--r-- | crates/ra_hir/src/lib.rs | 2 | ||||
-rw-r--r-- | crates/ra_hir/src/source_binder.rs | 12 | ||||
-rw-r--r-- | crates/ra_ide_api/src/call_info.rs | 2 | ||||
-rw-r--r-- | crates/ra_ide_api/src/completion/completion_context.rs | 4 | ||||
-rw-r--r-- | crates/ra_ide_api/src/goto_definition.rs | 2 | ||||
-rw-r--r-- | crates/ra_ide_api/src/hover.rs | 2 |
10 files changed, 18 insertions, 18 deletions
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< | |||
29 | } | 29 | } |
30 | // Infer type | 30 | // Infer type |
31 | let db = ctx.db; | 31 | let db = ctx.db; |
32 | let analyzer = hir::SourceAnalyser::new(db, ctx.frange.file_id, stmt.syntax()); | 32 | let analyzer = hir::SourceAnalyzer::new(db, ctx.frange.file_id, stmt.syntax()); |
33 | let ty = analyzer.type_of(db, expr)?; | 33 | let ty = analyzer.type_of(db, expr)?; |
34 | // Assist not applicable if the type is unknown | 34 | // Assist not applicable if the type is unknown |
35 | if is_unknown(&ty) { | 35 | 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( | |||
45 | let trait_def = { | 45 | let trait_def = { |
46 | let file_id = ctx.frange.file_id; | 46 | let file_id = ctx.frange.file_id; |
47 | let position = FilePosition { file_id, offset: impl_node.syntax().range().start() }; | 47 | let position = FilePosition { file_id, offset: impl_node.syntax().range().start() }; |
48 | let analyser = hir::SourceAnalyser::new(ctx.db, position.file_id, impl_node.syntax()); | 48 | let analyser = hir::SourceAnalyzer::new(ctx.db, position.file_id, impl_node.syntax()); |
49 | 49 | ||
50 | resolve_target_trait_def(ctx.db, &analyser, impl_node)? | 50 | resolve_target_trait_def(ctx.db, &analyser, impl_node)? |
51 | }; | 51 | }; |
@@ -121,13 +121,13 @@ fn add_missing_impl_members_inner( | |||
121 | /// implemented) to a `ast::TraitDef`. | 121 | /// implemented) to a `ast::TraitDef`. |
122 | fn resolve_target_trait_def( | 122 | fn resolve_target_trait_def( |
123 | db: &impl HirDatabase, | 123 | db: &impl HirDatabase, |
124 | binder: &hir::SourceAnalyser, | 124 | analyzer: &hir::SourceAnalyzer, |
125 | impl_block: &ast::ImplBlock, | 125 | impl_block: &ast::ImplBlock, |
126 | ) -> Option<TreeArc<ast::TraitDef>> { | 126 | ) -> Option<TreeArc<ast::TraitDef>> { |
127 | let ast_path = | 127 | let ast_path = |
128 | impl_block.target_trait().map(AstNode::syntax).and_then(ast::PathType::cast)?.path()?; | 128 | impl_block.target_trait().map(AstNode::syntax).and_then(ast::PathType::cast)?.path()?; |
129 | 129 | ||
130 | match binder.resolve_path(db, &ast_path) { | 130 | match analyzer.resolve_path(db, &ast_path) { |
131 | Some(hir::PathResolution::Def(hir::ModuleDef::Trait(def))) => Some(def.source(db).1), | 131 | Some(hir::PathResolution::Def(hir::ModuleDef::Trait(def))) => Some(def.source(db).1), |
132 | _ => None, | 132 | _ => None, |
133 | } | 133 | } |
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 | |||
20 | } | 20 | } |
21 | 21 | ||
22 | let expr = match_expr.expr()?; | 22 | let expr = match_expr.expr()?; |
23 | let analyzer = hir::SourceAnalyser::new(ctx.db, ctx.frange.file_id, expr.syntax()); | 23 | let analyzer = hir::SourceAnalyzer::new(ctx.db, ctx.frange.file_id, expr.syntax()); |
24 | let match_expr_ty = analyzer.type_of(ctx.db, expr)?; | 24 | let match_expr_ty = analyzer.type_of(ctx.db, expr)?; |
25 | let enum_def = match_expr_ty.autoderef(ctx.db).find_map(|ty| match ty.as_adt() { | 25 | let enum_def = match_expr_ty.autoderef(ctx.db).find_map(|ty| match ty.as_adt() { |
26 | Some((AdtDef::Enum(e), _)) => Some(e), | 26 | 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 | |||
51 | } | 51 | } |
52 | 52 | ||
53 | fn evaluate_struct_def_fields(&mut self) -> Option<()> { | 53 | fn evaluate_struct_def_fields(&mut self) -> Option<()> { |
54 | let analyzer = hir::SourceAnalyser::new( | 54 | let analyzer = hir::SourceAnalyzer::new( |
55 | self.ctx.db, | 55 | self.ctx.db, |
56 | self.ctx.frange.file_id, | 56 | self.ctx.frange.file_id, |
57 | self.struct_lit.syntax(), | 57 | 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::{ | |||
66 | adt::AdtDef, | 66 | adt::AdtDef, |
67 | expr::{ExprScopes, ScopesWithSourceMap, ScopeEntryWithSyntax}, | 67 | expr::{ExprScopes, ScopesWithSourceMap, ScopeEntryWithSyntax}, |
68 | resolve::{Resolver, Resolution}, | 68 | resolve::{Resolver, Resolution}, |
69 | source_binder::{SourceAnalyser, PathResolution}, | 69 | source_binder::{SourceAnalyzer, PathResolution}, |
70 | }; | 70 | }; |
71 | 71 | ||
72 | pub use self::code_model_api::{ | 72 | 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( | |||
261 | } | 261 | } |
262 | } | 262 | } |
263 | 263 | ||
264 | // Name is bad, don't use inside HIR | 264 | /// `SourceAnalyzer` |
265 | #[derive(Debug)] | 265 | #[derive(Debug)] |
266 | pub struct SourceAnalyser { | 266 | pub struct SourceAnalyzer { |
267 | resolver: Resolver, | 267 | resolver: Resolver, |
268 | body_source_map: Option<Arc<crate::expr::BodySourceMap>>, | 268 | body_source_map: Option<Arc<crate::expr::BodySourceMap>>, |
269 | infer: Option<Arc<crate::ty::InferenceResult>>, | 269 | infer: Option<Arc<crate::ty::InferenceResult>>, |
@@ -281,18 +281,18 @@ pub enum PathResolution { | |||
281 | AssocItem(crate::ImplItem), | 281 | AssocItem(crate::ImplItem), |
282 | } | 282 | } |
283 | 283 | ||
284 | impl SourceAnalyser { | 284 | impl SourceAnalyzer { |
285 | pub fn new(db: &impl HirDatabase, file_id: FileId, node: &SyntaxNode) -> SourceAnalyser { | 285 | pub fn new(db: &impl HirDatabase, file_id: FileId, node: &SyntaxNode) -> SourceAnalyzer { |
286 | let resolver = resolver_for_node(db, file_id, node); | 286 | let resolver = resolver_for_node(db, file_id, node); |
287 | let function = function_from_child_node(db, file_id, node); | 287 | let function = function_from_child_node(db, file_id, node); |
288 | if let Some(function) = function { | 288 | if let Some(function) = function { |
289 | SourceAnalyser { | 289 | SourceAnalyzer { |
290 | resolver, | 290 | resolver, |
291 | body_source_map: Some(function.body_source_map(db)), | 291 | body_source_map: Some(function.body_source_map(db)), |
292 | infer: Some(function.infer(db)), | 292 | infer: Some(function.infer(db)), |
293 | } | 293 | } |
294 | } else { | 294 | } else { |
295 | SourceAnalyser { resolver, body_source_map: None, infer: None } | 295 | SourceAnalyzer { resolver, body_source_map: None, infer: None } |
296 | } | 296 | } |
297 | } | 297 | } |
298 | 298 | ||
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 | |||
17 | let calling_node = FnCallNode::with_node(syntax, position.offset)?; | 17 | let calling_node = FnCallNode::with_node(syntax, position.offset)?; |
18 | let name_ref = calling_node.name_ref()?; | 18 | let name_ref = calling_node.name_ref()?; |
19 | 19 | ||
20 | let analyser = hir::SourceAnalyser::new(db, position.file_id, name_ref.syntax()); | 20 | let analyser = hir::SourceAnalyzer::new(db, position.file_id, name_ref.syntax()); |
21 | let function = match calling_node { | 21 | let function = match calling_node { |
22 | FnCallNode::CallExpr(expr) => { | 22 | FnCallNode::CallExpr(expr) => { |
23 | //FIXME: apply subst | 23 | //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}; | |||
14 | #[derive(Debug)] | 14 | #[derive(Debug)] |
15 | pub(crate) struct CompletionContext<'a> { | 15 | pub(crate) struct CompletionContext<'a> { |
16 | pub(super) db: &'a db::RootDatabase, | 16 | pub(super) db: &'a db::RootDatabase, |
17 | pub(super) analyzer: hir::SourceAnalyser, | 17 | pub(super) analyzer: hir::SourceAnalyzer, |
18 | pub(super) offset: TextUnit, | 18 | pub(super) offset: TextUnit, |
19 | pub(super) token: SyntaxToken<'a>, | 19 | pub(super) token: SyntaxToken<'a>, |
20 | pub(super) resolver: Resolver, | 20 | pub(super) resolver: Resolver, |
@@ -50,7 +50,7 @@ impl<'a> CompletionContext<'a> { | |||
50 | let resolver = source_binder::resolver_for_position(db, position); | 50 | let resolver = source_binder::resolver_for_position(db, position); |
51 | let module = source_binder::module_from_position(db, position); | 51 | let module = source_binder::module_from_position(db, position); |
52 | let token = find_token_at_offset(original_file.syntax(), position.offset).left_biased()?; | 52 | let token = find_token_at_offset(original_file.syntax(), position.offset).left_biased()?; |
53 | let analyzer = hir::SourceAnalyser::new(db, position.file_id, token.parent()); | 53 | let analyzer = hir::SourceAnalyzer::new(db, position.file_id, token.parent()); |
54 | let mut ctx = CompletionContext { | 54 | let mut ctx = CompletionContext { |
55 | db, | 55 | db, |
56 | analyzer, | 56 | 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( | |||
47 | ) -> ReferenceResult { | 47 | ) -> ReferenceResult { |
48 | use self::ReferenceResult::*; | 48 | use self::ReferenceResult::*; |
49 | 49 | ||
50 | let analyzer = hir::SourceAnalyser::new(db, file_id, name_ref.syntax()); | 50 | let analyzer = hir::SourceAnalyzer::new(db, file_id, name_ref.syntax()); |
51 | 51 | ||
52 | // Special cases: | 52 | // Special cases: |
53 | 53 | ||
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> { | |||
132 | .ancestors() | 132 | .ancestors() |
133 | .take_while(|it| it.range() == leaf_node.range()) | 133 | .take_while(|it| it.range() == leaf_node.range()) |
134 | .find(|&it| ast::Expr::cast(it).is_some() || ast::Pat::cast(it).is_some())?; | 134 | .find(|&it| ast::Expr::cast(it).is_some() || ast::Pat::cast(it).is_some())?; |
135 | let analyzer = hir::SourceAnalyser::new(db, frange.file_id, node); | 135 | let analyzer = hir::SourceAnalyzer::new(db, frange.file_id, node); |
136 | let ty = if let Some(ty) = ast::Expr::cast(node).and_then(|e| analyzer.type_of(db, e)) { | 136 | let ty = if let Some(ty) = ast::Expr::cast(node).and_then(|e| analyzer.type_of(db, e)) { |
137 | ty | 137 | ty |
138 | } else if let Some(ty) = ast::Pat::cast(node).and_then(|p| analyzer.type_of_pat(db, p)) { | 138 | } else if let Some(ty) = ast::Pat::cast(node).and_then(|p| analyzer.type_of_pat(db, p)) { |