mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 05:45:12 +00:00
Force passing Source when creating a SourceAnalyzer
This commit is contained in:
parent
1c819fc8f6
commit
d898ecb8f2
10 changed files with 51 additions and 53 deletions
|
@ -230,7 +230,8 @@ pub(crate) fn type_of(db: &RootDatabase, frange: FileRange) -> Option<String> {
|
|||
.ancestors()
|
||||
.take_while(|it| it.text_range() == leaf_node.text_range())
|
||||
.find(|it| ast::Expr::cast(it.clone()).is_some() || ast::Pat::cast(it.clone()).is_some())?;
|
||||
let analyzer = hir::SourceAnalyzer::new(db, frange.file_id, &node, None);
|
||||
let analyzer =
|
||||
hir::SourceAnalyzer::new(db, hir::Source::new(frange.file_id.into(), &node), None);
|
||||
let ty = if let Some(ty) = ast::Expr::cast(node.clone()).and_then(|e| analyzer.type_of(db, &e))
|
||||
{
|
||||
ty
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue