mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 12:29:21 +00:00
internal: Don't kick off inference in Semantics::descend_into_macros_impl
This commit is contained in:
parent
2ca3834c9f
commit
37a87708ae
2 changed files with 48 additions and 13 deletions
|
@ -50,7 +50,7 @@ impl SourceAnalyzer {
|
|||
pub(crate) fn new_for_body(
|
||||
db: &dyn HirDatabase,
|
||||
def: DefWithBodyId,
|
||||
node: InFile<&SyntaxNode>,
|
||||
node @ InFile { file_id, .. }: InFile<&SyntaxNode>,
|
||||
offset: Option<TextSize>,
|
||||
) -> SourceAnalyzer {
|
||||
let (body, source_map) = db.body_with_source_map(def);
|
||||
|
@ -65,7 +65,29 @@ impl SourceAnalyzer {
|
|||
body: Some(body),
|
||||
body_source_map: Some(source_map),
|
||||
infer: Some(db.infer(def)),
|
||||
file_id: node.file_id,
|
||||
file_id,
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn new_for_body_no_infer(
|
||||
db: &dyn HirDatabase,
|
||||
def: DefWithBodyId,
|
||||
node @ InFile { file_id, .. }: InFile<&SyntaxNode>,
|
||||
offset: Option<TextSize>,
|
||||
) -> SourceAnalyzer {
|
||||
let (body, source_map) = db.body_with_source_map(def);
|
||||
let scopes = db.expr_scopes(def);
|
||||
let scope = match offset {
|
||||
None => scope_for(&scopes, &source_map, node),
|
||||
Some(offset) => scope_for_offset(db, &scopes, &source_map, node.with_value(offset)),
|
||||
};
|
||||
let resolver = resolver_for_scope(db.upcast(), def, scope);
|
||||
SourceAnalyzer {
|
||||
resolver,
|
||||
body: Some(body),
|
||||
body_source_map: Some(source_map),
|
||||
infer: None,
|
||||
file_id,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue