make AstId untyped

This commit is contained in:
Aleksey Kladov 2019-05-13 19:39:06 +03:00
parent 033a32f349
commit 549728bba8
11 changed files with 29 additions and 24 deletions

View file

@ -1,6 +1,6 @@
use std::{fmt, any::Any};
use ra_syntax::{SyntaxNodePtr, TreeArc, AstPtr, TextRange, ast, SyntaxNode};
use ra_syntax::{SyntaxNodePtr, TreeArc, AstPtr, TextRange, ast, SyntaxNode, AstNode};
use relative_path::RelativePathBuf;
use crate::{HirFileId, HirDatabase, Name};
@ -30,7 +30,7 @@ pub trait Diagnostic: Any + Send + Sync + fmt::Debug + 'static {
impl dyn Diagnostic {
pub fn syntax_node(&self, db: &impl HirDatabase) -> TreeArc<SyntaxNode> {
let source_file = db.hir_parse(self.file());
self.syntax_node_ptr().to_node(&source_file).to_owned()
self.syntax_node_ptr().to_node(source_file.syntax()).to_owned()
}
pub fn downcast_ref<D: Diagnostic>(&self) -> Option<&D> {
self.as_any().downcast_ref()