mirror of
https://github.com/github/codeql.git
synced 2026-04-29 02:35:15 +02:00
Ruby: Fix performance of Filter.getAnAction
Only look at the current class and the immediate superclass. This will miss some edge cases but is much faster.
This commit is contained in:
@@ -65,13 +65,14 @@ module Filters {
|
||||
not exists(this.getOnlyArgument()) and
|
||||
forall(string except | except = this.getExceptArgument() | result.getName() != except)
|
||||
) and
|
||||
// This is a simple heuristic and will miss some cases.
|
||||
(
|
||||
result = this.getExpr().getEnclosingModule().getAMethod()
|
||||
// The action is in the same class as this call
|
||||
result = lookupMethod(this.getExpr().getEnclosingModule().getModule(), _)
|
||||
or
|
||||
exists(ModuleBase m |
|
||||
m.getModule() = this.getExpr().getEnclosingModule().getModule().getADescendent() and
|
||||
result = m.getAMethod()
|
||||
)
|
||||
// or the action is in an immediate subclass of this call
|
||||
result.getEnclosingModule().getModule().getAnImmediateAncestor() =
|
||||
this.getExpr().getEnclosingModule().getModule()
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user