diff options
author | Kirill Bulatov <[email protected]> | 2020-07-27 21:56:57 +0100 |
---|---|---|
committer | Kirill Bulatov <[email protected]> | 2020-08-11 13:09:08 +0100 |
commit | 21184a1b2a4bea57a7666432749b171414136c60 (patch) | |
tree | f009a6df8b59ee88952f722534312b9567930c51 /crates/ra_hir_expand | |
parent | cb0b13a583c0c20b57fd3529e2c01ab42bd8f04d (diff) |
Restore accidentally removed public method
Diffstat (limited to 'crates/ra_hir_expand')
-rw-r--r-- | crates/ra_hir_expand/src/diagnostics.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/crates/ra_hir_expand/src/diagnostics.rs b/crates/ra_hir_expand/src/diagnostics.rs index 074a8c45e..23f28a7f7 100644 --- a/crates/ra_hir_expand/src/diagnostics.rs +++ b/crates/ra_hir_expand/src/diagnostics.rs | |||
@@ -16,7 +16,7 @@ | |||
16 | 16 | ||
17 | use std::{any::Any, fmt}; | 17 | use std::{any::Any, fmt}; |
18 | 18 | ||
19 | use ra_syntax::SyntaxNodePtr; | 19 | use ra_syntax::{SyntaxNode, SyntaxNodePtr}; |
20 | 20 | ||
21 | use crate::{db::AstDatabase, InFile}; | 21 | use crate::{db::AstDatabase, InFile}; |
22 | 22 | ||
@@ -38,6 +38,11 @@ pub trait AstDiagnostic { | |||
38 | } | 38 | } |
39 | 39 | ||
40 | impl dyn Diagnostic { | 40 | impl dyn Diagnostic { |
41 | pub fn syntax_node(&self, db: &impl AstDatabase) -> SyntaxNode { | ||
42 | let node = db.parse_or_expand(self.source().file_id).unwrap(); | ||
43 | self.source().value.to_node(&node) | ||
44 | } | ||
45 | |||
41 | pub fn downcast_ref<D: Diagnostic>(&self) -> Option<&D> { | 46 | pub fn downcast_ref<D: Diagnostic>(&self) -> Option<&D> { |
42 | self.as_any().downcast_ref() | 47 | self.as_any().downcast_ref() |
43 | } | 48 | } |