mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-11-01 12:24:29 +00:00
Newtype ErasedFileAstId
This commit is contained in:
parent
fcb88832de
commit
188c577855
13 changed files with 52 additions and 39 deletions
|
|
@ -158,9 +158,7 @@ type ProtocolWrite<W: Write> = for<'o, 'msg> fn(out: &'o mut W, msg: &'msg str)
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use intern::{sym, Symbol};
|
||||
use la_arena::RawIdx;
|
||||
use span::{ErasedFileAstId, Span, SpanAnchor, SyntaxContextId};
|
||||
use text_size::{TextRange, TextSize};
|
||||
use span::{ErasedFileAstId, Span, SpanAnchor, SyntaxContextId, TextRange, TextSize};
|
||||
use tt::{Delimiter, DelimiterKind, Ident, Leaf, Literal, Punct, Spacing, Subtree, TokenTree};
|
||||
|
||||
use super::*;
|
||||
|
|
@ -171,7 +169,7 @@ mod tests {
|
|||
span::FileId::from_raw(0xe4e4e),
|
||||
span::Edition::CURRENT,
|
||||
),
|
||||
ast_id: ErasedFileAstId::from_raw(RawIdx::from(0)),
|
||||
ast_id: ErasedFileAstId::from_raw(0),
|
||||
};
|
||||
|
||||
let token_trees = Box::new([
|
||||
|
|
|
|||
|
|
@ -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),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue