feat(C & JS API): Add BinaryenHasMemorySegment#8286
feat(C & JS API): Add BinaryenHasMemorySegment#8286spotandjake wants to merge 3 commits intoWebAssembly:mainfrom
BinaryenHasMemorySegment#8286Conversation
This pr adds `BinaryenHasMemorySegment(module, name)` to the c api and `module.hasMemorySegment(name)` to the js api.
b7f5068 to
cd887c1
Compare
|
The current |
I certainly could implement a The options I see going forward here would be:
I am happy todo any one of those, I just wanted to make sure the pr scope was clear before implementing. |
This pr adds
BinaryenHasMemorySegment(module, name)to the c api andmodule.hasMemorySegment(name)to the js api.While adding a test to the grain compiler to check the size of a generated memory segment, I noticed that if the segment didn't exist, any operations on that segment would throw. As we are working from OCaml, we have no way to catch this fatal C++ exception related grain pr. As far as I am aware there is no other existing way to check if a segment exists.
This function allows a user to check for the existance of a segment before trying to perform operations on it.
Related Binaryen.ml Issue
Related Grain issue