Fix constant generation

This commit is contained in:
Rerumu
2022-05-19 17:09:44 -04:00
parent f9cf75c98a
commit 0e92163cb3
7 changed files with 115 additions and 112 deletions
+16 -1
View File
@@ -289,7 +289,22 @@ impl<'a> Builder<'a> {
}
#[must_use]
pub fn consume(mut self, index: usize, func: &'a FuncBody) -> Intermediate {
pub fn with_anon(mut self, mut inst: &[Instruction]) -> Intermediate {
self.num_result = 1;
let code = self.new_forward(&mut inst);
let num_stack = self.data.last_stack;
Intermediate {
local_data: Vec::new(),
num_param: 0,
num_stack,
code,
}
}
#[must_use]
pub fn with_index(mut self, index: usize, func: &'a FuncBody) -> Intermediate {
let arity = &self.type_info.arity_of(self.type_info.len_ex() + index);
self.num_result = arity.num_result;