mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
start descriptors -> hir rename
This commit is contained in:
parent
9f08341aa4
commit
d659b7a2f0
14 changed files with 34 additions and 27 deletions
|
@ -11,7 +11,7 @@ use rustc_hash::{FxHashMap};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
db::{self, SyntaxDatabase},
|
db::{self, SyntaxDatabase},
|
||||||
descriptors::{
|
hir::{
|
||||||
module::{ModuleDescriptor}
|
module::{ModuleDescriptor}
|
||||||
},
|
},
|
||||||
Cancelable, FilePosition
|
Cancelable, FilePosition
|
||||||
|
|
|
@ -10,7 +10,7 @@ use ra_syntax::{
|
||||||
use crate::{
|
use crate::{
|
||||||
db::RootDatabase,
|
db::RootDatabase,
|
||||||
completion::CompletionItem,
|
completion::CompletionItem,
|
||||||
descriptors::{
|
hir::{
|
||||||
module::{ModuleDescriptor},
|
module::{ModuleDescriptor},
|
||||||
function::FnScopes,
|
function::FnScopes,
|
||||||
Def,
|
Def,
|
||||||
|
|
|
@ -7,7 +7,7 @@ use salsa::{self, Database};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
db,
|
db,
|
||||||
descriptors,
|
hir,
|
||||||
symbol_index::SymbolIndex,
|
symbol_index::SymbolIndex,
|
||||||
syntax_ptr::SyntaxPtr,
|
syntax_ptr::SyntaxPtr,
|
||||||
loc2id::{IdMaps, IdDatabase},
|
loc2id::{IdMaps, IdDatabase},
|
||||||
|
@ -122,15 +122,15 @@ salsa::database_storage! {
|
||||||
fn file_symbols() for FileSymbolsQuery;
|
fn file_symbols() for FileSymbolsQuery;
|
||||||
fn resolve_syntax_ptr() for ResolveSyntaxPtrQuery;
|
fn resolve_syntax_ptr() for ResolveSyntaxPtrQuery;
|
||||||
}
|
}
|
||||||
impl descriptors::DescriptorDatabase {
|
impl hir::DescriptorDatabase {
|
||||||
fn module_tree() for descriptors::ModuleTreeQuery;
|
fn module_tree() for hir::ModuleTreeQuery;
|
||||||
fn fn_scopes() for descriptors::FnScopesQuery;
|
fn fn_scopes() for hir::FnScopesQuery;
|
||||||
fn _file_items() for descriptors::FileItemsQuery;
|
fn _file_items() for hir::FileItemsQuery;
|
||||||
fn _file_item() for descriptors::FileItemQuery;
|
fn _file_item() for hir::FileItemQuery;
|
||||||
fn _input_module_items() for descriptors::InputModuleItemsQuery;
|
fn _input_module_items() for hir::InputModuleItemsQuery;
|
||||||
fn _item_map() for descriptors::ItemMapQuery;
|
fn _item_map() for hir::ItemMapQuery;
|
||||||
fn _fn_syntax() for descriptors::FnSyntaxQuery;
|
fn _fn_syntax() for hir::FnSyntaxQuery;
|
||||||
fn _submodules() for descriptors::SubmodulesQuery;
|
fn _submodules() for hir::SubmodulesQuery;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ use std::sync::Arc;
|
||||||
|
|
||||||
use ra_syntax::ast::{AstNode, FnDef, FnDefNode};
|
use ra_syntax::ast::{AstNode, FnDef, FnDefNode};
|
||||||
|
|
||||||
use crate::descriptors::{
|
use crate::hir::{
|
||||||
function::{FnId, FnScopes},
|
function::{FnId, FnScopes},
|
||||||
DescriptorDatabase,
|
DescriptorDatabase,
|
||||||
};
|
};
|
|
@ -1,3 +1,10 @@
|
||||||
|
//! HIR (previsouly known as descriptors) provides a high-level OO acess to Rust
|
||||||
|
//! code.
|
||||||
|
//!
|
||||||
|
//! The principal difference between HIR and syntax trees is that HIR is bound
|
||||||
|
//! to a particular crate instance. That is, it has cfg flags and features
|
||||||
|
//! applied. So, there relation between syntax and HIR is many-to-one.
|
||||||
|
|
||||||
pub(crate) mod function;
|
pub(crate) mod function;
|
||||||
pub(crate) mod module;
|
pub(crate) mod module;
|
||||||
mod path;
|
mod path;
|
||||||
|
@ -12,8 +19,8 @@ use ra_syntax::{
|
||||||
use crate::{
|
use crate::{
|
||||||
FileId,
|
FileId,
|
||||||
db::SyntaxDatabase,
|
db::SyntaxDatabase,
|
||||||
descriptors::function::{resolve_local_name, FnId, FnScopes},
|
hir::function::{resolve_local_name, FnId, FnScopes},
|
||||||
descriptors::module::{
|
hir::module::{
|
||||||
ModuleId, ModuleTree, ModuleSource, ModuleDescriptor,
|
ModuleId, ModuleTree, ModuleSource, ModuleDescriptor,
|
||||||
nameres::{ItemMap, InputModuleItems, FileItems}
|
nameres::{ItemMap, InputModuleItems, FileItems}
|
||||||
},
|
},
|
|
@ -9,7 +9,7 @@ use rustc_hash::{FxHashMap, FxHashSet};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
db,
|
db,
|
||||||
descriptors::DescriptorDatabase,
|
hir::DescriptorDatabase,
|
||||||
input::{SourceRoot, SourceRootId},
|
input::{SourceRoot, SourceRootId},
|
||||||
Cancelable, FileId, FileResolverImp,
|
Cancelable, FileId, FileResolverImp,
|
||||||
};
|
};
|
|
@ -14,7 +14,7 @@ use relative_path::RelativePathBuf;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
db::SyntaxDatabase, syntax_ptr::SyntaxPtr, FileId, FilePosition, Cancelable,
|
db::SyntaxDatabase, syntax_ptr::SyntaxPtr, FileId, FilePosition, Cancelable,
|
||||||
descriptors::{Path, PathKind, DescriptorDatabase},
|
hir::{Path, PathKind, DescriptorDatabase},
|
||||||
input::SourceRootId,
|
input::SourceRootId,
|
||||||
arena::{Arena, Id},
|
arena::{Arena, Id},
|
||||||
loc2id::{DefLoc, DefId},
|
loc2id::{DefLoc, DefId},
|
|
@ -31,7 +31,7 @@ use ra_syntax::{
|
||||||
use crate::{
|
use crate::{
|
||||||
Cancelable, FileId,
|
Cancelable, FileId,
|
||||||
loc2id::{DefId, DefLoc},
|
loc2id::{DefId, DefLoc},
|
||||||
descriptors::{
|
hir::{
|
||||||
Path, PathKind,
|
Path, PathKind,
|
||||||
DescriptorDatabase,
|
DescriptorDatabase,
|
||||||
module::{ModuleId, ModuleTree, ModuleSourceNode},
|
module::{ModuleId, ModuleTree, ModuleSourceNode},
|
||||||
|
@ -447,7 +447,7 @@ mod tests {
|
||||||
use crate::{
|
use crate::{
|
||||||
AnalysisChange,
|
AnalysisChange,
|
||||||
mock_analysis::{MockAnalysis, analysis_and_position},
|
mock_analysis::{MockAnalysis, analysis_and_position},
|
||||||
descriptors::{DescriptorDatabase, module::ModuleDescriptor},
|
hir::{DescriptorDatabase, module::ModuleDescriptor},
|
||||||
input::FilesDatabase,
|
input::FilesDatabase,
|
||||||
};
|
};
|
||||||
use super::*;
|
use super::*;
|
|
@ -19,7 +19,7 @@ use salsa::{Database, ParallelDatabase};
|
||||||
use crate::{
|
use crate::{
|
||||||
completion::{completions, CompletionItem},
|
completion::{completions, CompletionItem},
|
||||||
db::{self, FileSyntaxQuery, SyntaxDatabase},
|
db::{self, FileSyntaxQuery, SyntaxDatabase},
|
||||||
descriptors::{
|
hir::{
|
||||||
function::{FnDescriptor, FnId},
|
function::{FnDescriptor, FnId},
|
||||||
module::{ModuleDescriptor, Problem},
|
module::{ModuleDescriptor, Problem},
|
||||||
DeclarationDescriptor, DescriptorDatabase,
|
DeclarationDescriptor, DescriptorDatabase,
|
||||||
|
@ -589,7 +589,7 @@ fn resolve_local_name(
|
||||||
let fn_def = name_ref.syntax().ancestors().find_map(ast::FnDef::cast)?;
|
let fn_def = name_ref.syntax().ancestors().find_map(ast::FnDef::cast)?;
|
||||||
let fn_id = FnId::get(db, file_id, fn_def);
|
let fn_id = FnId::get(db, file_id, fn_def);
|
||||||
let scopes = db.fn_scopes(fn_id);
|
let scopes = db.fn_scopes(fn_id);
|
||||||
let scope_entry = crate::descriptors::function::resolve_local_name(name_ref, &scopes)?;
|
let scope_entry = crate::hir::function::resolve_local_name(name_ref, &scopes)?;
|
||||||
let syntax = db.resolve_syntax_ptr(scope_entry.ptr().into_global(file_id));
|
let syntax = db.resolve_syntax_ptr(scope_entry.ptr().into_global(file_id));
|
||||||
Some((scope_entry.name().clone(), syntax.range()))
|
Some((scope_entry.name().clone(), syntax.range()))
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,14 +19,14 @@ macro_rules! ctry {
|
||||||
}
|
}
|
||||||
|
|
||||||
mod arena;
|
mod arena;
|
||||||
|
mod syntax_ptr;
|
||||||
|
mod input;
|
||||||
mod db;
|
mod db;
|
||||||
mod loc2id;
|
mod loc2id;
|
||||||
mod input;
|
|
||||||
mod imp;
|
mod imp;
|
||||||
mod completion;
|
mod completion;
|
||||||
mod descriptors;
|
mod hir;
|
||||||
mod symbol_index;
|
mod symbol_index;
|
||||||
mod syntax_ptr;
|
|
||||||
pub mod mock_analysis;
|
pub mod mock_analysis;
|
||||||
|
|
||||||
use std::{fmt, sync::Arc};
|
use std::{fmt, sync::Arc};
|
||||||
|
@ -42,7 +42,7 @@ use crate::{
|
||||||
|
|
||||||
pub use crate::{
|
pub use crate::{
|
||||||
completion::CompletionItem,
|
completion::CompletionItem,
|
||||||
descriptors::function::FnDescriptor,
|
hir::function::FnDescriptor,
|
||||||
input::{CrateGraph, CrateId, FileId, FileResolver},
|
input::{CrateGraph, CrateId, FileId, FileResolver},
|
||||||
};
|
};
|
||||||
pub use ra_editor::{
|
pub use ra_editor::{
|
||||||
|
|
|
@ -9,8 +9,8 @@ use rustc_hash::FxHashMap;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
FileId,
|
FileId,
|
||||||
descriptors::FileItemId,
|
hir::FileItemId,
|
||||||
descriptors::module::ModuleId,
|
hir::module::ModuleId,
|
||||||
syntax_ptr::SyntaxPtr,
|
syntax_ptr::SyntaxPtr,
|
||||||
input::SourceRootId,
|
input::SourceRootId,
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue