Use ‘index’ terminology for arena consistently

This commit is contained in:
Aramis Razzaghipour 2021-01-15 11:02:08 +11:00
parent 3224ecea87
commit 1d103cf087
No known key found for this signature in database
GPG key ID: F788F7E990136003
6 changed files with 56 additions and 53 deletions

View file

@ -13,7 +13,7 @@
//! See also a neighboring `body` module.
use hir_expand::name::Name;
use la_arena::{Idx, RawId};
use la_arena::{Idx, RawIdx};
use syntax::ast::RangeOp;
use crate::{
@ -24,7 +24,7 @@ use crate::{
pub type ExprId = Idx<Expr>;
pub(crate) fn dummy_expr_id() -> ExprId {
ExprId::from_raw(RawId::from(!0))
ExprId::from_raw(RawIdx::from(!0))
}
pub type PatId = Idx<Pat>;

View file

@ -20,7 +20,7 @@ use hir_expand::{
name::{name, AsName, Name},
HirFileId, InFile,
};
use la_arena::{Arena, Idx, RawId};
use la_arena::{Arena, Idx, RawIdx};
use rustc_hash::FxHashMap;
use smallvec::SmallVec;
use syntax::{ast, match_ast};

View file

@ -683,12 +683,12 @@ impl Ctx {
}
fn next_field_idx(&self) -> Idx<Field> {
Idx::from_raw(RawId::from(
Idx::from_raw(RawIdx::from(
self.tree.data.as_ref().map_or(0, |data| data.fields.len() as u32),
))
}
fn next_variant_idx(&self) -> Idx<Variant> {
Idx::from_raw(RawId::from(
Idx::from_raw(RawIdx::from(
self.tree.data.as_ref().map_or(0, |data| data.variants.len() as u32),
))
}

View file

@ -9,7 +9,7 @@
//! absolute offsets. The `Trace` structure (inspired, at least in name, by
//! Kotlin's `BindingTrace`) allows use the same code to compute both
//! projections.
use la_arena::{Arena, ArenaMap, Idx, RawId};
use la_arena::{Arena, ArenaMap, Idx, RawIdx};
pub(crate) struct Trace<T, V> {
arena: Option<Arena<T>>,
@ -30,7 +30,7 @@ impl<T, V> Trace<T, V> {
let id = if let Some(arena) = &mut self.arena {
arena.alloc(data())
} else {
let id = Idx::<T>::from_raw(RawId::from(self.len));
let id = Idx::<T>::from_raw(RawIdx::from(self.len));
self.len += 1;
id
};