Add Wasm support for recursive tags, along with GetTagId and UnionAtIndex

This commit is contained in:
Brian Carroll 2021-12-10 16:00:02 +00:00
parent 031dce61c9
commit f3ca3be507
3 changed files with 359 additions and 64 deletions

View file

@ -108,11 +108,17 @@ impl<'a> Storage<'a> {
self.stack_frame_size = 0;
}
/// Internal use only. If you think you want it externally, you really want `allocate`
/// Internal use only. See `allocate` or `create_anonymous_local`
fn get_next_local_id(&self) -> LocalId {
LocalId((self.arg_types.len() + self.local_types.len()) as u32)
}
pub fn create_anonymous_local(&mut self, value_type: ValueType) -> LocalId {
let id = self.get_next_local_id();
self.local_types.push(value_type);
id
}
/// Allocate storage for a Roc value
///
/// Wasm primitives (i32, i64, f32, f64) are allocated "storage" on the VM stack.