Assume conventionally named unresolved method references are properties or events#2677
Merged
dgrunwald merged 4 commits intoicsharpcode:masterfrom May 20, 2022
Merged
Conversation
dgrunwald
reviewed
Apr 26, 2022
dgrunwald
reviewed
Apr 26, 2022
Member
|
For tests, I think |
added 3 commits
April 27, 2022 15:35
…es or events. eg. decompiles to .Property instead of .get_Property()
eeca859 to
e563294
Compare
Contributor
Author
|
resolved review comment and added a test :) |
siegfriedpammer
added a commit
that referenced
this pull request
Jun 13, 2022
… detect set-accessors of FakeProperties. Bug likely introduced due to an oversight in #2677.
clin1234
pushed a commit
to clin1234/ILSpy
that referenced
this pull request
Jun 26, 2022
…to properly detect set-accessors of FakeProperties. Bug likely introduced due to an oversight in icsharpcode#2677.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.