Add interface method support for windows-rdl
#3865
Merged
+235
−27
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Building on #3861, this update adds parsing support interface methods, covering most of the type system capabilities required for WinRT and Win32 method signatures. Here's an example of a .rdl interface:
As you can see, the sytax largely follows Rust, with the addition of the
interfacekeyword. We could use the Rusttraitkeyword, but I'm worried that may be more confusing.Most of it should be self-explanatory. The
RefMutandRefConstmethod parameters are edge cases required by the WinRT type system forrefandoutparameters, while thePtrMutandPtrConstmethod parameters are examples typically found in Win32 APIs. As you can imagine, .rdl will support both type systems but I still need to distinguish between them so you don't accidentally add non-WinRT types to a WinRT interface for example.The reader will encode this interface into a .winmd file as follows:
More concisely, here's how ILSpy models it in C#:
Stay tuned for more!