dotnet-webassembly
dotnet-webassembly copied to clipboard
Legacy Exception Handling
This PR implements https://github.com/WebAssembly/exception-handling. The following is done:
Module structure
- [x] Tags
- [ ] Clean-up
- [ ] Import
- [ ] Export
- [ ] Name section
Control flow operators
- [x] try
- [x] catch
- [x] catch_all
- [ ] delegate
- [x] throw
- [x] rethrow
Other tasks
- [x] Fix possible out of range exceptions (when the tag index is out of range).
- [ ] Resolve all TODO's in code:
- [ ] Verify expected result type if there is no value
- [ ] Validate for invalid tags in
throwandcatch - [ ] Validate for invalid argument types in
throw
In C# I've created a WebAssemblyException which is thrown by the IL generator.
If the exception has parameters, the generic type will be used (WebAssemblyException<T0> and WebAssemblyException<T0, T1>. This is to prevent boxing.
As noted in #59, I don't want to merge the WebAssembly. prefixing in the OpCode XML due to that being a Rider bug. Any chance you could rebase without those changes to cut down on the size of this PR? Other than that, I'm pretty excited about what you've accomplished here.