Move load_symbol_and_layout to scope

This commit is contained in:
Ayaz Hafiz 2023-06-09 15:40:20 -05:00
parent 6e23365551
commit bbef63f28f
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
5 changed files with 54 additions and 59 deletions

View file

@ -35,6 +35,16 @@ impl<'a, 'ctx> Scope<'a, 'ctx> {
}
}
pub(crate) fn load_symbol_and_layout(
&self,
symbol: &Symbol,
) -> (BasicValueEnum<'ctx>, InLayout<'a>) {
match self.get(symbol) {
Some((layout, ptr)) => (*ptr, *layout),
None => panic!("There was no entry for {:?} in scope {:?}", symbol, self),
}
}
pub fn insert(&mut self, symbol: Symbol, value: (InLayout<'a>, BasicValueEnum<'ctx>)) {
self.symbols.insert(symbol, value);
}