remove SyntaxPtrDatabase
This commit is contained in:
parent
2b210d98b8
commit
2050812cad
4 changed files with 12 additions and 19 deletions
|
@ -1,7 +1,7 @@
|
|||
use std::sync::Arc;
|
||||
|
||||
use ra_editor::LineIndex;
|
||||
use ra_syntax::File;
|
||||
use ra_syntax::{File, SyntaxNode};
|
||||
use salsa;
|
||||
|
||||
use crate::{
|
||||
|
@ -11,7 +11,7 @@ use crate::{
|
|||
SubmodulesQuery,
|
||||
},
|
||||
symbol_index::SymbolIndex,
|
||||
syntax_ptr::{ResolveSyntaxPtrQuery, SyntaxPtrDatabase},
|
||||
syntax_ptr::SyntaxPtr,
|
||||
Cancelable, Canceled, FileId,
|
||||
};
|
||||
|
||||
|
@ -62,6 +62,7 @@ salsa::database_storage! {
|
|||
fn file_syntax() for FileSyntaxQuery;
|
||||
fn file_lines() for FileLinesQuery;
|
||||
fn file_symbols() for FileSymbolsQuery;
|
||||
fn resolve_syntax_ptr() for ResolveSyntaxPtrQuery;
|
||||
}
|
||||
impl DescriptorDatabase {
|
||||
fn module_tree() for ModuleTreeQuery;
|
||||
|
@ -70,9 +71,6 @@ salsa::database_storage! {
|
|||
fn fn_syntax() for FnSyntaxQuery;
|
||||
fn fn_scopes() for FnScopesQuery;
|
||||
}
|
||||
impl SyntaxPtrDatabase {
|
||||
fn resolve_syntax_ptr() for ResolveSyntaxPtrQuery;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -87,6 +85,12 @@ salsa::query_group! {
|
|||
fn file_symbols(file_id: FileId) -> Cancelable<Arc<SymbolIndex>> {
|
||||
type FileSymbolsQuery;
|
||||
}
|
||||
fn resolve_syntax_ptr(ptr: SyntaxPtr) -> SyntaxNode {
|
||||
type ResolveSyntaxPtrQuery;
|
||||
// Don't retain syntax trees in memory
|
||||
storage volatile;
|
||||
use fn crate::syntax_ptr::resolve_syntax_ptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,12 +13,12 @@ use crate::{
|
|||
descriptors::function::{resolve_local_name, FnId, FnScopes},
|
||||
descriptors::module::{ModuleId, ModuleScope, ModuleTree},
|
||||
input::SourceRootId,
|
||||
syntax_ptr::{LocalSyntaxPtr, SyntaxPtrDatabase},
|
||||
syntax_ptr::LocalSyntaxPtr,
|
||||
Cancelable, FileId,
|
||||
};
|
||||
|
||||
salsa::query_group! {
|
||||
pub(crate) trait DescriptorDatabase: SyntaxDatabase + SyntaxPtrDatabase {
|
||||
pub(crate) trait DescriptorDatabase: SyntaxDatabase {
|
||||
fn module_tree(source_root_id: SourceRootId) -> Cancelable<Arc<ModuleTree>> {
|
||||
type ModuleTreeQuery;
|
||||
use fn module::imp::module_tree;
|
||||
|
|
|
@ -25,7 +25,6 @@ use crate::{
|
|||
},
|
||||
input::{FilesDatabase, SourceRoot, SourceRootId, WORKSPACE},
|
||||
symbol_index::SymbolIndex,
|
||||
syntax_ptr::SyntaxPtrDatabase,
|
||||
AnalysisChange, Cancelable, CrateGraph, CrateId, Diagnostic, FileId, FileResolver,
|
||||
FileSystemEdit, Position, Query, SourceChange, SourceFileEdit,
|
||||
};
|
||||
|
|
|
@ -3,17 +3,7 @@ use ra_syntax::{File, SyntaxKind, SyntaxNode, SyntaxNodeRef, TextRange};
|
|||
use crate::db::SyntaxDatabase;
|
||||
use crate::FileId;
|
||||
|
||||
salsa::query_group! {
|
||||
pub(crate) trait SyntaxPtrDatabase: SyntaxDatabase {
|
||||
fn resolve_syntax_ptr(ptr: SyntaxPtr) -> SyntaxNode {
|
||||
type ResolveSyntaxPtrQuery;
|
||||
// Don't retain syntax trees in memory
|
||||
storage volatile;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn resolve_syntax_ptr(db: &impl SyntaxDatabase, ptr: SyntaxPtr) -> SyntaxNode {
|
||||
pub(crate) fn resolve_syntax_ptr(db: &impl SyntaxDatabase, ptr: SyntaxPtr) -> SyntaxNode {
|
||||
let syntax = db.file_syntax(ptr.file_id);
|
||||
ptr.local.resolve(&syntax)
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue