diff options
author | Aleksey Kladov <[email protected]> | 2020-04-17 10:38:51 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-04-17 11:25:41 +0100 |
commit | 302bf97bbf1855e3c7def9ab4f9f3d338be5e3b7 (patch) | |
tree | f26fcf569dea4fa40ca3814d30e340572a66374b /crates/ra_hir_ty/src/infer.rs | |
parent | 69f0cb6cd77c2dc93f2eed180a6c16fd8c3fca5a (diff) |
Don't expose impl details of SyntaxPtr
Diffstat (limited to 'crates/ra_hir_ty/src/infer.rs')
-rw-r--r-- | crates/ra_hir_ty/src/infer.rs | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/crates/ra_hir_ty/src/infer.rs b/crates/ra_hir_ty/src/infer.rs index 246b0e9be..7e6cdefe4 100644 --- a/crates/ra_hir_ty/src/infer.rs +++ b/crates/ra_hir_ty/src/infer.rs | |||
@@ -665,6 +665,7 @@ impl Expectation { | |||
665 | mod diagnostics { | 665 | mod diagnostics { |
666 | use hir_def::{expr::ExprId, src::HasSource, FunctionId, Lookup}; | 666 | use hir_def::{expr::ExprId, src::HasSource, FunctionId, Lookup}; |
667 | use hir_expand::diagnostics::DiagnosticSink; | 667 | use hir_expand::diagnostics::DiagnosticSink; |
668 | use ra_syntax::AstNode; | ||
668 | 669 | ||
669 | use crate::{db::HirDatabase, diagnostics::NoSuchField}; | 670 | use crate::{db::HirDatabase, diagnostics::NoSuchField}; |
670 | 671 | ||
@@ -682,10 +683,16 @@ mod diagnostics { | |||
682 | ) { | 683 | ) { |
683 | match self { | 684 | match self { |
684 | InferenceDiagnostic::NoSuchField { expr, field } => { | 685 | InferenceDiagnostic::NoSuchField { expr, field } => { |
685 | let file = owner.lookup(db.upcast()).source(db.upcast()).file_id; | 686 | let source = owner.lookup(db.upcast()).source(db.upcast()); |
686 | let (_, source_map) = db.body_with_source_map(owner.into()); | 687 | let (_, source_map) = db.body_with_source_map(owner.into()); |
687 | let field = source_map.field_syntax(*expr, *field); | 688 | let field = source_map.field_syntax(*expr, *field); |
688 | sink.push(NoSuchField { file, field }) | 689 | let root = field.file_syntax(db.upcast()); |
690 | let highlight_range = field.value.to_node(&root).syntax().text_range(); | ||
691 | sink.push(NoSuchField { | ||
692 | file: source.file_id, | ||
693 | field: field.value, | ||
694 | highlight_range, | ||
695 | }) | ||
689 | } | 696 | } |
690 | } | 697 | } |
691 | } | 698 | } |