mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 05:45:12 +00:00
move raw_items to hir_def
This commit is contained in:
parent
f996b6019b
commit
16e620c052
26 changed files with 1059 additions and 998 deletions
|
@ -12,7 +12,7 @@ use std::hash::{Hash, Hasher};
|
|||
use ra_db::{salsa, CrateId, FileId};
|
||||
use ra_syntax::ast::{self, AstNode};
|
||||
|
||||
use crate::{ast_id_map::FileAstId, db::AstDatabase};
|
||||
use crate::ast_id_map::FileAstId;
|
||||
|
||||
/// Input to the analyzer is a set of files, where each file is identified by
|
||||
/// `FileId` and contains source code. However, another source of source code in
|
||||
|
@ -50,7 +50,7 @@ impl From<MacroFile> for HirFileId {
|
|||
impl HirFileId {
|
||||
/// For macro-expansion files, returns the file original source file the
|
||||
/// expansion originated from.
|
||||
pub fn original_file(self, db: &dyn AstDatabase) -> FileId {
|
||||
pub fn original_file(self, db: &dyn db::AstDatabase) -> FileId {
|
||||
match self.0 {
|
||||
HirFileIdRepr::FileId(file_id) => file_id,
|
||||
HirFileIdRepr::MacroFile(macro_file) => {
|
||||
|
@ -61,7 +61,7 @@ impl HirFileId {
|
|||
}
|
||||
|
||||
/// Get the crate which the macro lives in, if it is a macro file.
|
||||
pub fn macro_crate(self, db: &dyn AstDatabase) -> Option<CrateId> {
|
||||
pub fn macro_crate(self, db: &dyn db::AstDatabase) -> Option<CrateId> {
|
||||
match self.0 {
|
||||
HirFileIdRepr::FileId(_) => None,
|
||||
HirFileIdRepr::MacroFile(macro_file) => {
|
||||
|
@ -154,7 +154,7 @@ impl<N: AstNode> AstId<N> {
|
|||
self.file_id
|
||||
}
|
||||
|
||||
pub fn to_node(&self, db: &dyn AstDatabase) -> N {
|
||||
pub fn to_node(&self, db: &dyn db::AstDatabase) -> N {
|
||||
let root = db.parse_or_expand(self.file_id).unwrap();
|
||||
db.ast_id_map(self.file_id).get(self.file_ast_id).to_node(&root)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue