From 201aa7ea2ae75f9599dc74ad2f4d3f41c1540e73 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 28 Nov 2018 02:15:21 +0300 Subject: remove syntax ptr --- crates/ra_analysis/src/db.rs | 10 +--------- crates/ra_analysis/src/syntax_ptr.rs | 17 ----------------- 2 files changed, 1 insertion(+), 26 deletions(-) (limited to 'crates/ra_analysis/src') diff --git a/crates/ra_analysis/src/db.rs b/crates/ra_analysis/src/db.rs index 97f170473..4c9c84e4f 100644 --- a/crates/ra_analysis/src/db.rs +++ b/crates/ra_analysis/src/db.rs @@ -2,13 +2,12 @@ use std::sync::Arc; #[cfg(test)] use parking_lot::Mutex; use ra_editor::LineIndex; -use ra_syntax::{SourceFileNode, SyntaxNode}; +use ra_syntax::{SourceFileNode}; use salsa::{self, Database}; use crate::{ hir, symbol_index::SymbolIndex, - syntax_ptr::SyntaxPtr, loc2id::{IdMaps}, Cancelable, Canceled, FileId, }; @@ -122,7 +121,6 @@ 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 hir::db::HirDatabase { fn module_tree() for hir::db::ModuleTreeQuery; @@ -148,12 +146,6 @@ salsa::query_group! { fn file_symbols(file_id: FileId) -> Cancelable> { type FileSymbolsQuery; } - fn resolve_syntax_ptr(ptr: SyntaxPtr) -> SyntaxNode { - type ResolveSyntaxPtrQuery; - // Don't retain syntax trees in memory - storage dependencies; - use fn crate::syntax_ptr::resolve_syntax_ptr; - } } } diff --git a/crates/ra_analysis/src/syntax_ptr.rs b/crates/ra_analysis/src/syntax_ptr.rs index 7bbf1fc33..f4b05fc19 100644 --- a/crates/ra_analysis/src/syntax_ptr.rs +++ b/crates/ra_analysis/src/syntax_ptr.rs @@ -1,22 +1,5 @@ use ra_syntax::{SourceFileNode, SyntaxKind, SyntaxNode, SyntaxNodeRef, TextRange}; -use crate::db::SyntaxDatabase; -use crate::FileId; - -pub(crate) fn resolve_syntax_ptr(db: &impl SyntaxDatabase, ptr: SyntaxPtr) -> SyntaxNode { - let syntax = db.file_syntax(ptr.file_id); - ptr.local.resolve(&syntax) -} - -/// SyntaxPtr is a cheap `Copy` id which identifies a particular syntax node, -/// without retaining syntax tree in memory. You need to explicitly `resolve` -/// `SyntaxPtr` to get a `SyntaxNode` -#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] -pub(crate) struct SyntaxPtr { - file_id: FileId, - local: LocalSyntaxPtr, -} - /// A pionter to a syntax node inside a file. #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] pub(crate) struct LocalSyntaxPtr { -- cgit v1.2.3