Add static type inference
This commit is contained in:
@@ -3,7 +3,7 @@ use std::sync::Arc;
|
||||
use ra_syntax::ast::{NameOwner};
|
||||
|
||||
use crate::{
|
||||
Name, AsName, Const, ConstSignature,
|
||||
Name, AsName, Const, ConstSignature, Static,
|
||||
type_ref::{TypeRef},
|
||||
PersistentHirDatabase,
|
||||
};
|
||||
@@ -23,4 +23,19 @@ impl ConstSignature {
|
||||
|
||||
Arc::new(sig)
|
||||
}
|
||||
|
||||
pub(crate) fn static_signature_query(
|
||||
db: &impl PersistentHirDatabase,
|
||||
konst: Static,
|
||||
) -> Arc<ConstSignature> {
|
||||
let (_, node) = konst.source(db);
|
||||
|
||||
let name = node.name().map(|n| n.as_name()).unwrap_or_else(Name::missing);
|
||||
|
||||
let type_ref = TypeRef::from_ast_opt(node.type_ref());
|
||||
|
||||
let sig = ConstSignature { name, type_ref };
|
||||
|
||||
Arc::new(sig)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user