Newtype ErasedFileAstId

This commit is contained in:
Lukas Wirth 2024-08-03 19:16:56 +02:00
parent fcb88832de
commit 188c577855
13 changed files with 52 additions and 39 deletions

View file

@ -38,11 +38,9 @@
use std::collections::VecDeque;
use intern::Symbol;
use la_arena::RawIdx;
use rustc_hash::FxHashMap;
use serde::{Deserialize, Serialize};
use span::{EditionedFileId, ErasedFileAstId, Span, SpanAnchor, SyntaxContextId};
use text_size::TextRange;
use span::{EditionedFileId, ErasedFileAstId, Span, SpanAnchor, SyntaxContextId, TextRange};
use crate::msg::{ENCODE_CLOSE_SPAN_VERSION, EXTENDED_LEAF_DATA};
@ -54,7 +52,7 @@ pub fn serialize_span_data_index_map(map: &SpanDataIndexMap) -> Vec<u32> {
.flat_map(|span| {
[
span.anchor.file_id.as_u32(),
span.anchor.ast_id.into_raw().into_u32(),
span.anchor.ast_id.into_raw(),
span.range.start().into(),
span.range.end().into(),
span.ctx.into_u32(),
@ -71,7 +69,7 @@ pub fn deserialize_span_data_index_map(map: &[u32]) -> SpanDataIndexMap {
Span {
anchor: SpanAnchor {
file_id: EditionedFileId::from_raw(file_id),
ast_id: ErasedFileAstId::from_raw(RawIdx::from_u32(ast_id)),
ast_id: ErasedFileAstId::from_raw(ast_id),
},
range: TextRange::new(start.into(), end.into()),
ctx: SyntaxContextId::from_u32(e),