diff options
author | Aleksey Kladov <[email protected]> | 2019-04-12 22:44:47 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-04-12 22:44:47 +0100 |
commit | 0fd93bc14a2d0ce2edd682d26c18979c13f181c5 (patch) | |
tree | e800dc46abe63bad2eaffaf7f3c0f4d8358d0c9a /crates/ra_ide_api | |
parent | 20013de2abb95bc024f55163b1a5044cfb52a873 (diff) |
use really correct resolver for expressions
Diffstat (limited to 'crates/ra_ide_api')
-rw-r--r-- | crates/ra_ide_api/src/call_info.rs | 2 | ||||
-rw-r--r-- | crates/ra_ide_api/src/completion/completion_context.rs | 3 | ||||
-rw-r--r-- | crates/ra_ide_api/src/goto_definition.rs | 2 | ||||
-rw-r--r-- | crates/ra_ide_api/src/hover.rs | 2 |
4 files changed, 5 insertions, 4 deletions
diff --git a/crates/ra_ide_api/src/call_info.rs b/crates/ra_ide_api/src/call_info.rs index a8495ab01..4413aec73 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 analyzer = hir::SourceAnalyzer::new(db, position.file_id, name_ref.syntax()); | 20 | let analyzer = hir::SourceAnalyzer::new(db, position.file_id, name_ref.syntax(), None); |
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 86b30e787..359f2cffa 100644 --- a/crates/ra_ide_api/src/completion/completion_context.rs +++ b/crates/ra_ide_api/src/completion/completion_context.rs | |||
@@ -48,7 +48,8 @@ impl<'a> CompletionContext<'a> { | |||
48 | ) -> Option<CompletionContext<'a>> { | 48 | ) -> Option<CompletionContext<'a>> { |
49 | let module = source_binder::module_from_position(db, position); | 49 | let module = source_binder::module_from_position(db, position); |
50 | let token = find_token_at_offset(original_file.syntax(), position.offset).left_biased()?; | 50 | let token = find_token_at_offset(original_file.syntax(), position.offset).left_biased()?; |
51 | let analyzer = hir::SourceAnalyzer::new(db, position.file_id, token.parent()); | 51 | let analyzer = |
52 | hir::SourceAnalyzer::new(db, position.file_id, token.parent(), Some(position.offset)); | ||
52 | let mut ctx = CompletionContext { | 53 | let mut ctx = CompletionContext { |
53 | db, | 54 | db, |
54 | analyzer, | 55 | analyzer, |
diff --git a/crates/ra_ide_api/src/goto_definition.rs b/crates/ra_ide_api/src/goto_definition.rs index abcc682e7..517dffbca 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::SourceAnalyzer::new(db, file_id, name_ref.syntax()); | 50 | let analyzer = hir::SourceAnalyzer::new(db, file_id, name_ref.syntax(), None); |
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 0cba5a665..397b56786 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::SourceAnalyzer::new(db, frange.file_id, node); | 135 | let analyzer = hir::SourceAnalyzer::new(db, frange.file_id, node, None); |
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)) { |