Break up arguments of insert

This commit is contained in:
Ayaz Hafiz 2023-06-09 15:44:21 -05:00
parent c57d254205
commit bb3cfb9cd3
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
2 changed files with 6 additions and 6 deletions

View file

@ -2435,7 +2435,7 @@ pub(crate) fn build_exp_stmt<'a, 'ctx>(
// access itself!
// scope = scope.clone();
scope.insert(*symbol, (*layout, val));
scope.insert(*symbol, *layout, val);
stack.push(*symbol);
}
@ -5233,7 +5233,7 @@ fn build_proc<'a, 'ctx>(
// Add args to scope
for (arg_val, (layout, arg_symbol)) in fn_val.get_param_iter().zip(args) {
arg_val.set_name(arg_symbol.as_str(&env.interns));
scope.insert(*arg_symbol, (*layout, arg_val));
scope.insert(*arg_symbol, *layout, arg_val);
}
let body = build_exp_stmt(

View file

@ -20,6 +20,10 @@ pub(crate) struct Scope<'a, 'ctx> {
pub(crate) struct JoinPointNotFound;
impl<'a, 'ctx> Scope<'a, 'ctx> {
pub fn insert(&mut self, symbol: Symbol, layout: InLayout<'a>, value: BasicValueEnum<'ctx>) {
self.symbols.insert(symbol, (layout, value));
}
pub fn load_symbol(&self, symbol: &Symbol) -> BasicValueEnum<'ctx> {
match self.symbols.get(symbol) {
Some((_, ptr)) => *ptr,
@ -38,10 +42,6 @@ impl<'a, 'ctx> Scope<'a, 'ctx> {
}
}
pub fn insert(&mut self, symbol: Symbol, value: (InLayout<'a>, BasicValueEnum<'ctx>)) {
self.symbols.insert(symbol, value);
}
pub fn insert_top_level_thunk(
&mut self,
symbol: Symbol,