mirror of
https://github.com/github/codeql.git
synced 2026-04-30 11:15:13 +02:00
Ruby: Refactor getFilterCallable
Try to force a join with the filter argument string first, to reduce tuple counts.
This commit is contained in:
@@ -104,6 +104,10 @@ module Filters {
|
||||
|
||||
StringlikeLiteralCfgNode getFilterArgument() { result = this.getPositionalArgument(_) }
|
||||
|
||||
string getFilterArgumentName() {
|
||||
result = this.getFilterArgument().getConstantValue().getStringlikeValue()
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the callable that implements the filter with name `name`.
|
||||
* This currently only finds methods in the local class or superclass.
|
||||
@@ -122,8 +126,8 @@ module Filters {
|
||||
* end
|
||||
* ```
|
||||
*/
|
||||
Callable getFilterCallable(string name) {
|
||||
result.(MethodBase).getName() = name and
|
||||
Callable getAFilterCallable() {
|
||||
this.getFilterArgumentName() = result.(MethodBase).getName() and
|
||||
result.getEnclosingModule().getModule() =
|
||||
this.getExpr().getEnclosingModule().getModule().getAnAncestor()
|
||||
}
|
||||
@@ -321,7 +325,9 @@ module Filters {
|
||||
|
||||
string getFilterName() { result = this.getConstantValue().getStringlikeValue() }
|
||||
|
||||
Callable getFilterCallable() { result = call.getFilterCallable(this.getFilterName()) }
|
||||
Callable getFilterCallable() {
|
||||
result = call.getAFilterCallable() and result.(MethodBase).getName() = this.getFilterName()
|
||||
}
|
||||
|
||||
ActionControllerActionMethod getAnAction() { result = call.getAnAction() }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user