mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 13:29:12 +00:00
LayoutIds use LayoutRepr
This commit is contained in:
parent
94e97df54a
commit
ee25735731
5 changed files with 21 additions and 26 deletions
|
@ -4451,14 +4451,14 @@ impl LayoutId {
|
|||
}
|
||||
|
||||
struct IdsByLayout<'a> {
|
||||
by_id: MutMap<InLayout<'a>, u32>,
|
||||
by_id: MutMap<LayoutRepr<'a>, u32>,
|
||||
toplevels_by_id: MutMap<crate::ir::ProcLayout<'a>, u32>,
|
||||
next_id: u32,
|
||||
}
|
||||
|
||||
impl<'a> IdsByLayout<'a> {
|
||||
#[inline(always)]
|
||||
fn insert_layout(&mut self, layout: InLayout<'a>) -> LayoutId {
|
||||
fn insert_layout(&mut self, layout: LayoutRepr<'a>) -> LayoutId {
|
||||
match self.by_id.entry(layout) {
|
||||
Entry::Vacant(vacant) => {
|
||||
let answer = self.next_id;
|
||||
|
@ -4472,7 +4472,7 @@ impl<'a> IdsByLayout<'a> {
|
|||
}
|
||||
|
||||
#[inline(always)]
|
||||
fn singleton_layout(layout: InLayout<'a>) -> (Self, LayoutId) {
|
||||
fn singleton_layout(layout: LayoutRepr<'a>) -> (Self, LayoutId) {
|
||||
let mut by_id = HashMap::with_capacity_and_hasher(1, default_hasher());
|
||||
by_id.insert(layout, 1);
|
||||
|
||||
|
@ -4523,7 +4523,7 @@ impl<'a> LayoutIds<'a> {
|
|||
/// Returns a LayoutId which is unique for the given symbol and layout.
|
||||
/// If given the same symbol and same layout, returns the same LayoutId.
|
||||
#[inline(always)]
|
||||
pub fn get<'b>(&mut self, symbol: Symbol, layout: &'b InLayout<'a>) -> LayoutId {
|
||||
pub fn get<'b>(&mut self, symbol: Symbol, layout: &'b LayoutRepr<'a>) -> LayoutId {
|
||||
match self.by_symbol.entry(symbol) {
|
||||
Entry::Vacant(vacant) => {
|
||||
let (ids_by_layout, layout_id) = IdsByLayout::singleton_layout(*layout);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue