cleanup unwrap

This commit is contained in:
Anton-4 2021-10-15 19:01:41 +02:00
parent d3f2b95f7a
commit e003725f21
13 changed files with 110 additions and 55 deletions

View file

@ -1,7 +1,9 @@
use crate::ident::{Ident, ModuleName};
use crate::module_err::{ModuleIdNotFound, ModuleResult};
use roc_collections::all::{default_hasher, MutMap, SendMap};
use roc_ident::IdentStr;
use roc_region::all::Region;
use snafu::OptionExt;
use std::collections::HashMap;
use std::{fmt, u32};
@ -253,6 +255,15 @@ impl Interns {
pub fn from_index(module_id: ModuleId, ident_id: u32) -> Symbol {
Symbol::new(module_id, IdentId(ident_id))
}
pub fn get_module_ident_ids(&self, module_id: &ModuleId) -> ModuleResult<&IdentIds> {
self.all_ident_ids
.get(module_id)
.with_context(|| ModuleIdNotFound {
module_id: format!("{:?}", module_id),
all_ident_ids: format!("{:?}", self.all_ident_ids),
})
}
}
#[cfg(debug_assertions)]