mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 06:11:35 +00:00
Semantical call info
This commit is contained in:
parent
9210fcc076
commit
ff0312fa32
12 changed files with 313 additions and 261 deletions
|
@ -322,15 +322,15 @@ fn get_fn_signature(sema: &Semantics<RootDatabase>, expr: &ast::Expr) -> Option<
|
|||
match expr {
|
||||
ast::Expr::CallExpr(expr) => {
|
||||
// FIXME: Type::as_callable is broken for closures
|
||||
let callable_def = sema.type_of_expr(&expr.expr()?)?.as_callable()?;
|
||||
match callable_def {
|
||||
hir::CallableDefId::FunctionId(it) => {
|
||||
let callable = sema.type_of_expr(&expr.expr()?)?.as_callable(sema.db)?;
|
||||
match callable.kind() {
|
||||
hir::CallableKind::Function(it) => {
|
||||
Some(FunctionSignature::from_hir(sema.db, it.into()))
|
||||
}
|
||||
hir::CallableDefId::StructId(it) => {
|
||||
hir::CallableKind::TupleStruct(it) => {
|
||||
FunctionSignature::from_struct(sema.db, it.into())
|
||||
}
|
||||
hir::CallableDefId::EnumVariantId(it) => {
|
||||
hir::CallableKind::TupleEnumVariant(it) => {
|
||||
FunctionSignature::from_enum_variant(sema.db, it.into())
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue