Use From to get an owned AST

This commit is contained in:
Aleksey Kladov 2018-11-01 13:41:04 +03:00
parent 3ec9f958b3
commit d685a9b564
3 changed files with 701 additions and 402 deletions

View file

@ -11,8 +11,7 @@ use crate::descriptors::{
/// TODO: this should return something more type-safe then `SyntaxNode`
pub(crate) fn fn_syntax(db: &impl DescriptorDatabase, fn_id: FnId) -> FnDefNode {
let syntax = db.resolve_syntax_ptr(fn_id.0);
let fn_def = FnDef::cast(syntax.borrowed()).unwrap();
FnDefNode::new(fn_def)
FnDef::cast(syntax.borrowed()).unwrap().into()
}
pub(crate) fn fn_scopes(db: &impl DescriptorDatabase, fn_id: FnId) -> Arc<FnScopes> {