mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-01 15:51:12 +00:00
Add Wasm support for recursive tags, along with GetTagId and UnionAtIndex
This commit is contained in:
parent
031dce61c9
commit
f3ca3be507
3 changed files with 359 additions and 64 deletions
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue