This commit is contained in:
Sergey Pepyakin
2017-12-11 19:48:09 +01:00
parent 0d982429ab
commit 4795f04767

View File

@@ -20,7 +20,9 @@ pub struct TypeId(u32);
impl TypeId {
pub fn resolve<'s>(&self, store: &'s Store) -> &'s FunctionType {
store.resolve_type(*self)
store.types
.get(self.0 as usize)
.expect("ID should always be a valid index")
}
}
@@ -221,12 +223,6 @@ impl Store {
.expect("ID should always be a valid index")
}
fn resolve_type(&self, id: TypeId) -> &FunctionType {
self.types
.get(id.0 as usize)
.expect("ID should always be a valid index")
}
pub fn alloc_func_type(&mut self, func_type: FunctionType) -> TypeId {
self.types.push(func_type);
let type_id = self.types.len() - 1;