binaryen
binaryen copied to clipboard
Add helper `getSingleMemory`
I wonder if it's worth having a method like wasm.getOnlyMemory that asserts that there is exactly one memory and returns is. Then finding all the places that need to be updated to handle multi-memory could be found by searching for uses of that method.
Originally posted by @tlively in https://github.com/WebAssembly/binaryen/pull/4811#discussion_r938212968
This sounds like a good idea to me. I think getSingleMemory would be perhaps a better name given existing getSingle* stuff we have. Also the method could be on MemoryUtils.
Originally posted by @kripken in https://github.com/WebAssembly/binaryen/pull/4811#discussion_r946954463