mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-28 02:29:44 +00:00
Make HirFileId, EditionedFileId and macro files Salsa struct
And make more queries non-interned. Also flip the default for queries, now the default is to not intern and to intern a query you need to say `invoke_interned`.
This commit is contained in:
parent
02ade79631
commit
c58ddafe90
195 changed files with 1473 additions and 1525 deletions
|
|
@ -29,7 +29,7 @@ use hir_def::{
|
|||
type_ref::{Mutability, TypeRef, TypeRefId},
|
||||
};
|
||||
use hir_expand::{
|
||||
HirFileId, InFile, MacroFileId, MacroFileIdExt,
|
||||
HirFileId, InFile, MacroCallId,
|
||||
mod_path::{ModPath, PathKind, path},
|
||||
name::{AsName, Name},
|
||||
};
|
||||
|
|
@ -47,10 +47,9 @@ use hir_ty::{
|
|||
use intern::sym;
|
||||
use itertools::Itertools;
|
||||
use smallvec::SmallVec;
|
||||
use syntax::ast::{RangeItem, RangeOp};
|
||||
use syntax::{
|
||||
SyntaxKind, SyntaxNode, TextRange, TextSize,
|
||||
ast::{self, AstNode},
|
||||
ast::{self, AstNode, RangeItem, RangeOp},
|
||||
};
|
||||
use triomphe::Arc;
|
||||
|
||||
|
|
@ -216,7 +215,7 @@ impl SourceAnalyzer {
|
|||
})
|
||||
}
|
||||
|
||||
pub(crate) fn expansion(&self, node: InFile<&ast::MacroCall>) -> Option<MacroFileId> {
|
||||
pub(crate) fn expansion(&self, node: InFile<&ast::MacroCall>) -> Option<MacroCallId> {
|
||||
self.store_sm()?.expansion(node)
|
||||
}
|
||||
|
||||
|
|
@ -750,7 +749,7 @@ impl SourceAnalyzer {
|
|||
let bs = self.store_sm()?;
|
||||
bs.expansion(macro_call).and_then(|it| {
|
||||
// FIXME: Block def maps
|
||||
let def = it.macro_call_id.lookup(db).def;
|
||||
let def = it.lookup(db).def;
|
||||
db.crate_def_map(def.krate)
|
||||
.macro_def_to_macro_id
|
||||
.get(&def.kind.erased_ast_id())
|
||||
|
|
@ -1197,15 +1196,11 @@ impl SourceAnalyzer {
|
|||
&self,
|
||||
db: &dyn HirDatabase,
|
||||
macro_call: InFile<&ast::MacroCall>,
|
||||
) -> Option<MacroFileId> {
|
||||
) -> Option<MacroCallId> {
|
||||
self.store_sm().and_then(|bs| bs.expansion(macro_call)).or_else(|| {
|
||||
self.resolver
|
||||
.item_scope()
|
||||
.macro_invoc(
|
||||
macro_call
|
||||
.with_value(db.ast_id_map(macro_call.file_id).ast_id(macro_call.value)),
|
||||
)
|
||||
.map(|it| it.as_macro_file())
|
||||
self.resolver.item_scope().macro_invoc(
|
||||
macro_call.with_value(db.ast_id_map(macro_call.file_id).ast_id(macro_call.value)),
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue