mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 13:29:12 +00:00
Move load_symbol to scope
This commit is contained in:
parent
8d3d4ed9d8
commit
6e23365551
4 changed files with 31 additions and 33 deletions
|
@ -24,6 +24,17 @@ impl<'a, 'ctx> Scope<'a, 'ctx> {
|
|||
self.symbols.get(symbol)
|
||||
}
|
||||
|
||||
pub fn load_symbol(&self, symbol: &Symbol) -> BasicValueEnum<'ctx> {
|
||||
match self.get(symbol) {
|
||||
Some((_, ptr)) => *ptr,
|
||||
|
||||
None => panic!(
|
||||
"There was no entry for {:?} {} in scope {:?}",
|
||||
symbol, symbol, self
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn insert(&mut self, symbol: Symbol, value: (InLayout<'a>, BasicValueEnum<'ctx>)) {
|
||||
self.symbols.insert(symbol, value);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue