Ruby: support WithBlock and WithoutBlock

This commit is contained in:
Asger Feldthaus
2022-02-24 13:04:47 +01:00
parent d6bc9c259e
commit 388949f12e
4 changed files with 24 additions and 1 deletions

View File

@@ -86,7 +86,13 @@ API::Node getExtraSuccessorFromInvoke(InvokeNode node, AccessPathToken token) {
* Holds if `invoke` matches the Ruby-specific call site filter in `token`.
*/
bindingset[token]
predicate invocationMatchesExtraCallSiteFilter(InvokeNode invoke, AccessPathToken token) { none() }
predicate invocationMatchesExtraCallSiteFilter(InvokeNode invoke, AccessPathToken token) {
token.getName() = "WithBlock" and
exists(invoke.getBlock())
or
token.getName() = "WithoutBlock" and
not exists(invoke.getBlock())
}
/** An API graph node representing a method call. */
class InvokeNode extends API::MethodAccessNode {