Assume conventionally named unresolved method references are properties or events #2677
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.
eg. decompile to
.Propertyinstead of.get_Property()Problem
Two assemblies:
And
If the first is unresolvable/missing, the second can't desugar properties or event handlers and decompiles to:
Solution
While technically we can't be 100% sure, it's a pretty safe bet to assume calls to
get_,add_, etc. are properties and event handers.With this PR, the method decompiles to this:
This creates a new
FakePropertyorFakeEventfor each method reference, which means that eg. getters and setter won't be associated with each other. It's consistent in thatUsedBystill won't work, I guess.I'm not sure how
raise_(.fire) works, but I implemented it anyway to fit the pattern.I don't think it needs a configuration to disable/enable, as the regular desugaring option should work.