mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 06:11:35 +00:00
rename TreePtr -> TreeArc
This is much clearer about the semantics
This commit is contained in:
parent
aad1bf877e
commit
2d3940d0ab
25 changed files with 197 additions and 197 deletions
|
@ -7,7 +7,7 @@ pub mod mock;
|
|||
|
||||
use std::panic;
|
||||
|
||||
use ra_syntax::{TextUnit, TextRange, SourceFile, TreePtr};
|
||||
use ra_syntax::{TextUnit, TextRange, SourceFile, TreeArc};
|
||||
|
||||
pub use crate::{
|
||||
cancellation::{Canceled, Cancelable},
|
||||
|
@ -40,13 +40,13 @@ pub trait BaseDatabase: salsa::Database + panic::RefUnwindSafe {
|
|||
|
||||
salsa::query_group! {
|
||||
pub trait SyntaxDatabase: crate::input::FilesDatabase + BaseDatabase {
|
||||
fn source_file(file_id: FileId) -> TreePtr<SourceFile> {
|
||||
fn source_file(file_id: FileId) -> TreeArc<SourceFile> {
|
||||
type SourceFileQuery;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn source_file(db: &impl SyntaxDatabase, file_id: FileId) -> TreePtr<SourceFile> {
|
||||
fn source_file(db: &impl SyntaxDatabase, file_id: FileId) -> TreeArc<SourceFile> {
|
||||
let text = db.file_text(file_id);
|
||||
SourceFile::parse(&*text)
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use ra_syntax::{AstNode, SourceFile, SyntaxKind, SyntaxNode, TextRange, TreePtr};
|
||||
use ra_syntax::{AstNode, SourceFile, SyntaxKind, SyntaxNode, TextRange, TreeArc};
|
||||
|
||||
/// A pointer to a syntax node inside a file.
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
||||
|
@ -15,7 +15,7 @@ impl LocalSyntaxPtr {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn resolve(self, file: &SourceFile) -> TreePtr<SyntaxNode> {
|
||||
pub fn resolve(self, file: &SourceFile) -> TreeArc<SyntaxNode> {
|
||||
let mut curr = file.syntax();
|
||||
loop {
|
||||
if curr.range() == self.range && curr.kind() == self.kind {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue