-
Notifications
You must be signed in to change notification settings - Fork 1.8k
C#: Strengthen call-back heuristics by considering body-less methods #14832
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
302add9
to
393628a
Compare
393628a
to
ccb9d9b
Compare
not c.hasBody() and | ||
(if c instanceof AddEventAccessor then not c.fromSource() else any()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This same pattern is also used in SsaImpl.qll
. Should it be refactored into a predicate?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code in SsaImpl.qll
will go away once we adopt the shared variable capture library, which is expected to happen next quarter.
target = c.getTarget() and | ||
not target.hasBody() | ||
| | ||
if target instanceof AddEventAccessor then not target.fromSource() else any() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need to special case AddEventAccessor
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because default event accessors will not invoke the callbacks that they are provided, merely add/remove them from the list of callbacks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why don't we need to special case RemoveEventAccessor
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoops, that's definitely a mistake. I think I will simply include all accessors, since the same holds for auto-generated getters/setters.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Previously, we would assume that calls to library methods would invoke their passed delegates. This is now generalized to include any method without a body (i.e., also abstract methods and interface methods).