mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 13:51:31 +00:00
use loc2id for FnIds
This commit is contained in:
parent
cb22a799d6
commit
4e48917c00
6 changed files with 70 additions and 22 deletions
|
@ -8,17 +8,18 @@ use ra_syntax::{
|
|||
TextRange, TextUnit,
|
||||
};
|
||||
|
||||
use crate::{syntax_ptr::SyntaxPtr, FileId};
|
||||
use crate::{
|
||||
syntax_ptr::SyntaxPtr, FileId,
|
||||
loc2id::IdDatabase,
|
||||
};
|
||||
|
||||
pub(crate) use self::scope::{resolve_local_name, FnScopes};
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
||||
pub(crate) struct FnId(SyntaxPtr);
|
||||
pub(crate) use crate::loc2id::FnId;
|
||||
|
||||
impl FnId {
|
||||
pub(crate) fn new(file_id: FileId, fn_def: ast::FnDef) -> FnId {
|
||||
pub(crate) fn get(db: &impl IdDatabase, file_id: FileId, fn_def: ast::FnDef) -> FnId {
|
||||
let ptr = SyntaxPtr::new(file_id, fn_def.syntax());
|
||||
FnId(ptr)
|
||||
db.id_maps().fn_id(ptr)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue