diff options
Diffstat (limited to 'crates/ra_hir/src/source_binder.rs')
-rw-r--r-- | crates/ra_hir/src/source_binder.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/crates/ra_hir/src/source_binder.rs b/crates/ra_hir/src/source_binder.rs index b9d3a1713..05f5bca57 100644 --- a/crates/ra_hir/src/source_binder.rs +++ b/crates/ra_hir/src/source_binder.rs | |||
@@ -168,7 +168,7 @@ impl SourceAnalyzer { | |||
168 | resolver, | 168 | resolver, |
169 | body_owner: Some(def), | 169 | body_owner: Some(def), |
170 | body_source_map: Some(source_map), | 170 | body_source_map: Some(source_map), |
171 | infer: Some(db.infer(def)), | 171 | infer: Some(db.infer(def.into())), |
172 | scopes: Some(scopes), | 172 | scopes: Some(scopes), |
173 | file_id: node.file_id, | 173 | file_id: node.file_id, |
174 | } | 174 | } |
@@ -214,27 +214,27 @@ impl SourceAnalyzer { | |||
214 | 214 | ||
215 | pub fn resolve_method_call(&self, call: &ast::MethodCallExpr) -> Option<Function> { | 215 | pub fn resolve_method_call(&self, call: &ast::MethodCallExpr) -> Option<Function> { |
216 | let expr_id = self.expr_id(&call.clone().into())?; | 216 | let expr_id = self.expr_id(&call.clone().into())?; |
217 | self.infer.as_ref()?.method_resolution(expr_id) | 217 | self.infer.as_ref()?.method_resolution(expr_id).map(Function::from) |
218 | } | 218 | } |
219 | 219 | ||
220 | pub fn resolve_field(&self, field: &ast::FieldExpr) -> Option<crate::StructField> { | 220 | pub fn resolve_field(&self, field: &ast::FieldExpr) -> Option<crate::StructField> { |
221 | let expr_id = self.expr_id(&field.clone().into())?; | 221 | let expr_id = self.expr_id(&field.clone().into())?; |
222 | self.infer.as_ref()?.field_resolution(expr_id) | 222 | self.infer.as_ref()?.field_resolution(expr_id).map(|it| it.into()) |
223 | } | 223 | } |
224 | 224 | ||
225 | pub fn resolve_record_field(&self, field: &ast::RecordField) -> Option<crate::StructField> { | 225 | pub fn resolve_record_field(&self, field: &ast::RecordField) -> Option<crate::StructField> { |
226 | let expr_id = self.expr_id(&field.expr()?)?; | 226 | let expr_id = self.expr_id(&field.expr()?)?; |
227 | self.infer.as_ref()?.record_field_resolution(expr_id) | 227 | self.infer.as_ref()?.record_field_resolution(expr_id).map(|it| it.into()) |
228 | } | 228 | } |
229 | 229 | ||
230 | pub fn resolve_record_literal(&self, record_lit: &ast::RecordLit) -> Option<crate::VariantDef> { | 230 | pub fn resolve_record_literal(&self, record_lit: &ast::RecordLit) -> Option<crate::VariantDef> { |
231 | let expr_id = self.expr_id(&record_lit.clone().into())?; | 231 | let expr_id = self.expr_id(&record_lit.clone().into())?; |
232 | self.infer.as_ref()?.variant_resolution_for_expr(expr_id) | 232 | self.infer.as_ref()?.variant_resolution_for_expr(expr_id).map(|it| it.into()) |
233 | } | 233 | } |
234 | 234 | ||
235 | pub fn resolve_record_pattern(&self, record_pat: &ast::RecordPat) -> Option<crate::VariantDef> { | 235 | pub fn resolve_record_pattern(&self, record_pat: &ast::RecordPat) -> Option<crate::VariantDef> { |
236 | let pat_id = self.pat_id(&record_pat.clone().into())?; | 236 | let pat_id = self.pat_id(&record_pat.clone().into())?; |
237 | self.infer.as_ref()?.variant_resolution_for_pat(pat_id) | 237 | self.infer.as_ref()?.variant_resolution_for_pat(pat_id).map(|it| it.into()) |
238 | } | 238 | } |
239 | 239 | ||
240 | pub fn resolve_macro_call( | 240 | pub fn resolve_macro_call( |
@@ -297,13 +297,13 @@ impl SourceAnalyzer { | |||
297 | if let Some(path_expr) = path.syntax().parent().and_then(ast::PathExpr::cast) { | 297 | if let Some(path_expr) = path.syntax().parent().and_then(ast::PathExpr::cast) { |
298 | let expr_id = self.expr_id(&path_expr.into())?; | 298 | let expr_id = self.expr_id(&path_expr.into())?; |
299 | if let Some(assoc) = self.infer.as_ref()?.assoc_resolutions_for_expr(expr_id) { | 299 | if let Some(assoc) = self.infer.as_ref()?.assoc_resolutions_for_expr(expr_id) { |
300 | return Some(PathResolution::AssocItem(assoc)); | 300 | return Some(PathResolution::AssocItem(assoc.into())); |
301 | } | 301 | } |
302 | } | 302 | } |
303 | if let Some(path_pat) = path.syntax().parent().and_then(ast::PathPat::cast) { | 303 | if let Some(path_pat) = path.syntax().parent().and_then(ast::PathPat::cast) { |
304 | let pat_id = self.pat_id(&path_pat.into())?; | 304 | let pat_id = self.pat_id(&path_pat.into())?; |
305 | if let Some(assoc) = self.infer.as_ref()?.assoc_resolutions_for_pat(pat_id) { | 305 | if let Some(assoc) = self.infer.as_ref()?.assoc_resolutions_for_pat(pat_id) { |
306 | return Some(PathResolution::AssocItem(assoc)); | 306 | return Some(PathResolution::AssocItem(assoc.into())); |
307 | } | 307 | } |
308 | } | 308 | } |
309 | // This must be a normal source file rather than macro file. | 309 | // This must be a normal source file rather than macro file. |