diff options
author | Florian Diebold <[email protected]> | 2018-12-23 16:13:11 +0000 |
---|---|---|
committer | Florian Diebold <[email protected]> | 2018-12-23 16:13:11 +0000 |
commit | ef67581104eb00a0c199f0b2a3b558da8a6f90a2 (patch) | |
tree | b6cf180b26152fa06ec4b2d02e22221fb7ba7fad /crates/ra_hir/src/query_definitions.rs | |
parent | 93ffbf80c632a7d38fc8bbdf6357bfd26a96a35a (diff) |
Resolve paths to defs (functions currently) during type inference
Diffstat (limited to 'crates/ra_hir/src/query_definitions.rs')
-rw-r--r-- | crates/ra_hir/src/query_definitions.rs | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/crates/ra_hir/src/query_definitions.rs b/crates/ra_hir/src/query_definitions.rs index ccbfdf028..b654af920 100644 --- a/crates/ra_hir/src/query_definitions.rs +++ b/crates/ra_hir/src/query_definitions.rs | |||
@@ -11,7 +11,7 @@ use ra_syntax::{ | |||
11 | use ra_db::{SourceRootId, FileId, Cancelable,}; | 11 | use ra_db::{SourceRootId, FileId, Cancelable,}; |
12 | 12 | ||
13 | use crate::{ | 13 | use crate::{ |
14 | SourceFileItems, SourceItemId, DefKind, | 14 | SourceFileItems, SourceItemId, DefKind, Function, DefId, |
15 | db::HirDatabase, | 15 | db::HirDatabase, |
16 | function::{FnScopes, FnId}, | 16 | function::{FnScopes, FnId}, |
17 | module::{ | 17 | module::{ |
@@ -19,7 +19,7 @@ use crate::{ | |||
19 | imp::Submodule, | 19 | imp::Submodule, |
20 | nameres::{InputModuleItems, ItemMap, Resolver}, | 20 | nameres::{InputModuleItems, ItemMap, Resolver}, |
21 | }, | 21 | }, |
22 | ty::{self, InferenceResult} | 22 | ty::{self, InferenceResult, Ty} |
23 | }; | 23 | }; |
24 | 24 | ||
25 | /// Resolve `FnId` to the corresponding `SyntaxNode` | 25 | /// Resolve `FnId` to the corresponding `SyntaxNode` |
@@ -36,11 +36,13 @@ pub(super) fn fn_scopes(db: &impl HirDatabase, fn_id: FnId) -> Arc<FnScopes> { | |||
36 | Arc::new(res) | 36 | Arc::new(res) |
37 | } | 37 | } |
38 | 38 | ||
39 | pub(super) fn infer(db: &impl HirDatabase, fn_id: FnId) -> Arc<InferenceResult> { | 39 | pub(super) fn infer(db: &impl HirDatabase, fn_id: FnId) -> Cancelable<Arc<InferenceResult>> { |
40 | let syntax = db.fn_syntax(fn_id); | 40 | let function = Function { fn_id }; |
41 | let scopes = db.fn_scopes(fn_id); | 41 | ty::infer(db, function).map(Arc::new) |
42 | let res = ty::infer(db, syntax.borrowed(), scopes); | 42 | } |
43 | Arc::new(res) | 43 | |
44 | pub(super) fn type_for_def(db: &impl HirDatabase, def_id: DefId) -> Cancelable<Ty> { | ||
45 | ty::type_for_def(db, def_id) | ||
44 | } | 46 | } |
45 | 47 | ||
46 | pub(super) fn file_items(db: &impl HirDatabase, file_id: FileId) -> Arc<SourceFileItems> { | 48 | pub(super) fn file_items(db: &impl HirDatabase, file_id: FileId) -> Arc<SourceFileItems> { |