mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-06-14 21:41:23 +00:00
Add an accessor for the function table
This commit adds an intrinsics to the `wasm_bindgen` crate which accesses the `WebAssembly.Table` which is the function table of the module. Eventually the thinking is that a module would import its own function table via native wasm functionality (via `anyref` and such), but until that's implemented let's add a binding for it ourselves! Closes #1427
This commit is contained in:
@ -783,6 +783,14 @@ impl<'a> Context<'a> {
|
||||
))
|
||||
})?;
|
||||
|
||||
self.bind("__wbindgen_function_table", &|me| {
|
||||
me.function_table_needed = true;
|
||||
Ok(format!(
|
||||
"function() {{ return {}; }}",
|
||||
me.add_heap_object("wasm.__wbg_function_table")
|
||||
))
|
||||
})?;
|
||||
|
||||
self.bind("__wbindgen_rethrow", &|me| {
|
||||
Ok(format!(
|
||||
"function(idx) {{ throw {}; }}",
|
||||
|
Reference in New Issue
Block a user