diff options
author | Aleksey Kladov <[email protected]> | 2019-11-24 17:53:42 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-11-24 17:53:42 +0000 |
commit | e48430cbae32249e50dda1b39e0c98a31f118250 (patch) | |
tree | 18e4c33b4ca4dfbf8ea8a797bfb7b856865b21c8 /crates/ra_hir/src/source_binder.rs | |
parent | d157812cd16f58128646c05bf1b80522d43acfd8 (diff) |
Simplify
Diffstat (limited to 'crates/ra_hir/src/source_binder.rs')
-rw-r--r-- | crates/ra_hir/src/source_binder.rs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/crates/ra_hir/src/source_binder.rs b/crates/ra_hir/src/source_binder.rs index 9e5ce5508..31390bb7f 100644 --- a/crates/ra_hir/src/source_binder.rs +++ b/crates/ra_hir/src/source_binder.rs | |||
@@ -28,8 +28,7 @@ use crate::{ | |||
28 | expr::{BodySourceMap, ExprScopes, ScopeId}, | 28 | expr::{BodySourceMap, ExprScopes, ScopeId}, |
29 | ty::method_resolution::{self, implements_trait}, | 29 | ty::method_resolution::{self, implements_trait}, |
30 | Adt, AssocItem, Const, DefWithBody, Either, Enum, EnumVariant, FromSource, Function, | 30 | Adt, AssocItem, Const, DefWithBody, Either, Enum, EnumVariant, FromSource, Function, |
31 | GenericParam, HasBody, Local, MacroDef, Name, Path, ScopeDef, Static, Struct, Trait, Ty, | 31 | GenericParam, Local, MacroDef, Name, Path, ScopeDef, Static, Struct, Trait, Ty, TypeAlias, |
32 | TypeAlias, | ||
33 | }; | 32 | }; |
34 | 33 | ||
35 | fn try_get_resolver_for_node(db: &impl HirDatabase, node: Source<&SyntaxNode>) -> Option<Resolver> { | 34 | fn try_get_resolver_for_node(db: &impl HirDatabase, node: Source<&SyntaxNode>) -> Option<Resolver> { |
@@ -155,8 +154,8 @@ impl SourceAnalyzer { | |||
155 | ) -> SourceAnalyzer { | 154 | ) -> SourceAnalyzer { |
156 | let def_with_body = def_with_body_from_child_node(db, node); | 155 | let def_with_body = def_with_body_from_child_node(db, node); |
157 | if let Some(def) = def_with_body { | 156 | if let Some(def) = def_with_body { |
158 | let source_map = def.body_source_map(db); | 157 | let (_body, source_map) = db.body_with_source_map(def.into()); |
159 | let scopes = def.expr_scopes(db); | 158 | let scopes = db.expr_scopes(def.into()); |
160 | let scope = match offset { | 159 | let scope = match offset { |
161 | None => scope_for(&scopes, &source_map, node), | 160 | None => scope_for(&scopes, &source_map, node), |
162 | Some(offset) => scope_for_offset(&scopes, &source_map, node.with_value(offset)), | 161 | Some(offset) => scope_for_offset(&scopes, &source_map, node.with_value(offset)), |
@@ -166,7 +165,7 @@ impl SourceAnalyzer { | |||
166 | resolver, | 165 | resolver, |
167 | body_owner: Some(def), | 166 | body_owner: Some(def), |
168 | body_source_map: Some(source_map), | 167 | body_source_map: Some(source_map), |
169 | infer: Some(def.infer(db)), | 168 | infer: Some(db.infer(def)), |
170 | scopes: Some(scopes), | 169 | scopes: Some(scopes), |
171 | file_id: node.file_id, | 170 | file_id: node.file_id, |
172 | } | 171 | } |