mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 14:51:48 +00:00
chore: rename salsa to ra_salsa
This commit is contained in:
parent
7b2548bd8d
commit
ccee36e8dd
104 changed files with 540 additions and 538 deletions
|
@ -1,7 +1,7 @@
|
|||
//! Defines a unit of change that can applied to the database to get the next
|
||||
//! state. Changes are transactional.
|
||||
use base_db::{
|
||||
salsa::Durability, CrateGraph, CrateId, CrateWorkspaceData, FileChange, SourceRoot,
|
||||
ra_salsa::Durability, CrateGraph, CrateId, CrateWorkspaceData, FileChange, SourceRoot,
|
||||
SourceRootDatabase,
|
||||
};
|
||||
use rustc_hash::FxHashMap;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
//! Defines database & queries for macro expansion.
|
||||
|
||||
use base_db::{salsa, CrateId, SourceDatabase};
|
||||
use base_db::{ra_salsa, CrateId, SourceDatabase};
|
||||
use either::Either;
|
||||
use limit::Limit;
|
||||
use mbe::MatchedArmIndex;
|
||||
|
@ -53,32 +53,32 @@ pub enum TokenExpander {
|
|||
ProcMacro(CustomProcMacroExpander),
|
||||
}
|
||||
|
||||
#[salsa::query_group(ExpandDatabaseStorage)]
|
||||
#[ra_salsa::query_group(ExpandDatabaseStorage)]
|
||||
pub trait ExpandDatabase: SourceDatabase {
|
||||
/// The proc macros.
|
||||
#[salsa::input]
|
||||
#[ra_salsa::input]
|
||||
fn proc_macros(&self) -> Arc<ProcMacros>;
|
||||
|
||||
fn ast_id_map(&self, file_id: HirFileId) -> Arc<AstIdMap>;
|
||||
|
||||
/// Main public API -- parses a hir file, not caring whether it's a real
|
||||
/// file or a macro expansion.
|
||||
#[salsa::transparent]
|
||||
#[ra_salsa::transparent]
|
||||
fn parse_or_expand(&self, file_id: HirFileId) -> SyntaxNode;
|
||||
/// Implementation for the macro case.
|
||||
#[salsa::lru]
|
||||
#[ra_salsa::lru]
|
||||
fn parse_macro_expansion(
|
||||
&self,
|
||||
macro_file: MacroFileId,
|
||||
) -> ExpandResult<(Parse<SyntaxNode>, Arc<ExpansionSpanMap>)>;
|
||||
#[salsa::transparent]
|
||||
#[salsa::invoke(SpanMap::new)]
|
||||
#[ra_salsa::transparent]
|
||||
#[ra_salsa::invoke(SpanMap::new)]
|
||||
fn span_map(&self, file_id: HirFileId) -> SpanMap;
|
||||
|
||||
#[salsa::transparent]
|
||||
#[salsa::invoke(crate::span_map::expansion_span_map)]
|
||||
#[ra_salsa::transparent]
|
||||
#[ra_salsa::invoke(crate::span_map::expansion_span_map)]
|
||||
fn expansion_span_map(&self, file_id: MacroFileId) -> Arc<ExpansionSpanMap>;
|
||||
#[salsa::invoke(crate::span_map::real_span_map)]
|
||||
#[ra_salsa::invoke(crate::span_map::real_span_map)]
|
||||
fn real_span_map(&self, file_id: EditionedFileId) -> Arc<RealSpanMap>;
|
||||
|
||||
/// Macro ids. That's probably the tricksiest bit in rust-analyzer, and the
|
||||
|
@ -86,15 +86,15 @@ pub trait ExpandDatabase: SourceDatabase {
|
|||
///
|
||||
/// We encode macro definitions into ids of macro calls, this what allows us
|
||||
/// to be incremental.
|
||||
#[salsa::interned]
|
||||
#[ra_salsa::interned]
|
||||
fn intern_macro_call(&self, macro_call: MacroCallLoc) -> MacroCallId;
|
||||
#[salsa::interned]
|
||||
#[ra_salsa::interned]
|
||||
fn intern_syntax_context(&self, ctx: SyntaxContextData) -> SyntaxContextId;
|
||||
|
||||
#[salsa::transparent]
|
||||
#[ra_salsa::transparent]
|
||||
fn setup_syntax_context_root(&self) -> ();
|
||||
#[salsa::transparent]
|
||||
#[salsa::invoke(crate::hygiene::dump_syntax_contexts)]
|
||||
#[ra_salsa::transparent]
|
||||
#[ra_salsa::invoke(crate::hygiene::dump_syntax_contexts)]
|
||||
fn dump_syntax_contexts(&self) -> String;
|
||||
|
||||
/// Lowers syntactic macro call to a token tree representation. That's a firewall
|
||||
|
@ -102,18 +102,18 @@ pub trait ExpandDatabase: SourceDatabase {
|
|||
/// subtree.
|
||||
#[deprecated = "calling this is incorrect, call `macro_arg_considering_derives` instead"]
|
||||
fn macro_arg(&self, id: MacroCallId) -> MacroArgResult;
|
||||
#[salsa::transparent]
|
||||
#[ra_salsa::transparent]
|
||||
fn macro_arg_considering_derives(
|
||||
&self,
|
||||
id: MacroCallId,
|
||||
kind: &MacroCallKind,
|
||||
) -> MacroArgResult;
|
||||
/// Fetches the expander for this macro.
|
||||
#[salsa::transparent]
|
||||
#[salsa::invoke(TokenExpander::macro_expander)]
|
||||
#[ra_salsa::transparent]
|
||||
#[ra_salsa::invoke(TokenExpander::macro_expander)]
|
||||
fn macro_expander(&self, id: MacroDefId) -> TokenExpander;
|
||||
/// Fetches (and compiles) the expander of this decl macro.
|
||||
#[salsa::invoke(DeclarativeMacroExpander::expander)]
|
||||
#[ra_salsa::invoke(DeclarativeMacroExpander::expander)]
|
||||
fn decl_macro_expander(
|
||||
&self,
|
||||
def_crate: CrateId,
|
||||
|
@ -135,7 +135,7 @@ pub trait ExpandDatabase: SourceDatabase {
|
|||
&self,
|
||||
macro_call: MacroCallId,
|
||||
) -> Option<Arc<ExpandResult<Arc<[SyntaxError]>>>>;
|
||||
#[salsa::transparent]
|
||||
#[ra_salsa::transparent]
|
||||
fn syntax_context(&self, file: HirFileId) -> SyntaxContextId;
|
||||
}
|
||||
|
||||
|
|
|
@ -97,7 +97,7 @@ fn apply_mark_internal(
|
|||
call_id: MacroCallId,
|
||||
transparency: Transparency,
|
||||
) -> SyntaxContextId {
|
||||
use base_db::salsa;
|
||||
use base_db::ra_salsa;
|
||||
|
||||
let call_id = Some(call_id);
|
||||
|
||||
|
@ -107,7 +107,7 @@ fn apply_mark_internal(
|
|||
|
||||
if transparency >= Transparency::Opaque {
|
||||
let parent = opaque;
|
||||
opaque = salsa::plumbing::get_query_table::<InternSyntaxContextQuery>(db).get_or_insert(
|
||||
opaque = ra_salsa::plumbing::get_query_table::<InternSyntaxContextQuery>(db).get_or_insert(
|
||||
(parent, call_id, transparency),
|
||||
|new_opaque| SyntaxContextData {
|
||||
outer_expn: call_id,
|
||||
|
@ -122,7 +122,7 @@ fn apply_mark_internal(
|
|||
if transparency >= Transparency::SemiTransparent {
|
||||
let parent = opaque_and_semitransparent;
|
||||
opaque_and_semitransparent =
|
||||
salsa::plumbing::get_query_table::<InternSyntaxContextQuery>(db).get_or_insert(
|
||||
ra_salsa::plumbing::get_query_table::<InternSyntaxContextQuery>(db).get_or_insert(
|
||||
(parent, call_id, transparency),
|
||||
|new_opaque_and_semitransparent| SyntaxContextData {
|
||||
outer_expn: call_id,
|
||||
|
@ -200,7 +200,7 @@ pub fn marks_rev(
|
|||
|
||||
pub(crate) fn dump_syntax_contexts(db: &dyn ExpandDatabase) -> String {
|
||||
use crate::db::{InternMacroCallLookupQuery, InternSyntaxContextLookupQuery};
|
||||
use base_db::salsa::debug::DebugQueryTable;
|
||||
use base_db::ra_salsa::debug::DebugQueryTable;
|
||||
|
||||
let mut s = String::from("Expansions:");
|
||||
let mut entries = InternMacroCallLookupQuery.in_db(db).entries::<Vec<_>>();
|
||||
|
|
|
@ -30,7 +30,7 @@ use triomphe::Arc;
|
|||
|
||||
use std::hash::Hash;
|
||||
|
||||
use base_db::{salsa::InternValueTrivial, CrateId};
|
||||
use base_db::{ra_salsa::InternValueTrivial, CrateId};
|
||||
use either::Either;
|
||||
use span::{
|
||||
Edition, EditionedFileId, ErasedFileAstId, FileAstId, HirFileIdRepr, Span, SpanAnchor,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue