aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_expand
diff options
context:
space:
mode:
authorKirill Bulatov <[email protected]>2020-07-27 21:56:57 +0100
committerKirill Bulatov <[email protected]>2020-08-11 13:09:08 +0100
commit21184a1b2a4bea57a7666432749b171414136c60 (patch)
treef009a6df8b59ee88952f722534312b9567930c51 /crates/ra_hir_expand
parentcb0b13a583c0c20b57fd3529e2c01ab42bd8f04d (diff)
Restore accidentally removed public method
Diffstat (limited to 'crates/ra_hir_expand')
-rw-r--r--crates/ra_hir_expand/src/diagnostics.rs7
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
17use std::{any::Any, fmt}; 17use std::{any::Any, fmt};
18 18
19use ra_syntax::SyntaxNodePtr; 19use ra_syntax::{SyntaxNode, SyntaxNodePtr};
20 20
21use crate::{db::AstDatabase, InFile}; 21use crate::{db::AstDatabase, InFile};
22 22
@@ -38,6 +38,11 @@ pub trait AstDiagnostic {
38} 38}
39 39
40impl dyn Diagnostic { 40impl 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 }