diff options
Diffstat (limited to 'crates/ra_hir/src/expr.rs')
-rw-r--r-- | crates/ra_hir/src/expr.rs | 26 |
1 files changed, 1 insertions, 25 deletions
diff --git a/crates/ra_hir/src/expr.rs b/crates/ra_hir/src/expr.rs index 8c4c63fda..3ca0a4de5 100644 --- a/crates/ra_hir/src/expr.rs +++ b/crates/ra_hir/src/expr.rs | |||
@@ -13,7 +13,7 @@ use crate::{ | |||
13 | diagnostics::{MissingFields, MissingOkInTailExpr}, | 13 | diagnostics::{MissingFields, MissingOkInTailExpr}, |
14 | resolve::HasResolver, | 14 | resolve::HasResolver, |
15 | ty::{ApplicationTy, InferenceResult, Ty, TypeCtor}, | 15 | ty::{ApplicationTy, InferenceResult, Ty, TypeCtor}, |
16 | Adt, DefWithBody, Function, HasBody, Name, Path, Resolver, | 16 | Adt, Function, Name, Path, |
17 | }; | 17 | }; |
18 | 18 | ||
19 | pub use hir_def::{ | 19 | pub use hir_def::{ |
@@ -27,30 +27,6 @@ pub use hir_def::{ | |||
27 | }, | 27 | }, |
28 | }; | 28 | }; |
29 | 29 | ||
30 | // needs arbitrary_self_types to be a method... or maybe move to the def? | ||
31 | pub(crate) fn resolver_for_expr( | ||
32 | db: &impl HirDatabase, | ||
33 | owner: DefWithBody, | ||
34 | expr_id: ExprId, | ||
35 | ) -> Resolver { | ||
36 | let scopes = owner.expr_scopes(db); | ||
37 | resolver_for_scope(db, owner, scopes.scope_for(expr_id)) | ||
38 | } | ||
39 | |||
40 | pub(crate) fn resolver_for_scope( | ||
41 | db: &impl HirDatabase, | ||
42 | owner: DefWithBody, | ||
43 | scope_id: Option<ScopeId>, | ||
44 | ) -> Resolver { | ||
45 | let mut r = owner.resolver(db); | ||
46 | let scopes = owner.expr_scopes(db); | ||
47 | let scope_chain = scopes.scope_chain(scope_id).collect::<Vec<_>>(); | ||
48 | for scope in scope_chain.into_iter().rev() { | ||
49 | r = r.push_expr_scope(owner.into(), Arc::clone(&scopes), scope); | ||
50 | } | ||
51 | r | ||
52 | } | ||
53 | |||
54 | pub(crate) struct ExprValidator<'a, 'b: 'a> { | 30 | pub(crate) struct ExprValidator<'a, 'b: 'a> { |
55 | func: Function, | 31 | func: Function, |
56 | infer: Arc<InferenceResult>, | 32 | infer: Arc<InferenceResult>, |