internal: Less file parsing for symbol index generation

This commit is contained in:
Lukas Wirth 2023-05-18 08:25:06 +02:00
parent 478705baf5
commit d6dcfa5744
5 changed files with 19 additions and 35 deletions

View file

@ -124,6 +124,10 @@ impl AstIdMap {
FileAstId { raw, _ty: PhantomData }
}
pub fn get<N: AstNode>(&self, id: FileAstId<N>) -> AstPtr<N> {
AstPtr::try_from_raw(self.arena[id.raw].clone()).unwrap()
}
fn erased_ast_id(&self, item: &SyntaxNode) -> ErasedFileAstId {
let ptr = SyntaxNodePtr::new(item);
let hash = hash_ptr(&ptr);
@ -137,10 +141,6 @@ impl AstIdMap {
}
}
pub fn get<N: AstNode>(&self, id: FileAstId<N>) -> AstPtr<N> {
AstPtr::try_from_raw(self.arena[id.raw].clone()).unwrap()
}
fn alloc(&mut self, item: &SyntaxNode) -> ErasedFileAstId {
self.arena.alloc(SyntaxNodePtr::new(item))
}