mirror of
https://github.com/github/codeql.git
synced 2025-12-20 02:44:30 +01:00
34 lines
1021 B
Plaintext
34 lines
1021 B
Plaintext
import ruby
|
|
|
|
private string getMethodName(Call c) {
|
|
result = c.(MethodCall).getMethodName()
|
|
or
|
|
not c instanceof MethodCall and result = "(none)"
|
|
}
|
|
|
|
query predicate callsWithNoReceiverArgumentsOrBlock(Call c, string name) {
|
|
name = getMethodName(c) and
|
|
not exists(c.(MethodCall).getReceiver()) and
|
|
not exists(c.getAnArgument()) and
|
|
not exists(c.(MethodCall).getBlock())
|
|
}
|
|
|
|
query predicate callsWithArguments(Call c, string name, int n, Expr argN) {
|
|
name = getMethodName(c) and
|
|
argN = c.getArgument(n)
|
|
}
|
|
|
|
query predicate callsWithReceiver(MethodCall c, Expr rcv) { rcv = c.getReceiver() }
|
|
|
|
query predicate callsWithBlock(MethodCall c, Block b) { b = c.getBlock() }
|
|
|
|
query predicate yieldCalls(YieldCall c) { any() }
|
|
|
|
query predicate superCalls(SuperCall c) { any() }
|
|
|
|
query predicate superCallsWithArguments(SuperCall c, int n, Expr argN) { argN = c.getArgument(n) }
|
|
|
|
query predicate superCallsWithBlock(SuperCall c, Block b) { b = c.getBlock() }
|
|
|
|
query predicate setterCalls(SetterMethodCall c) { any() }
|