mirror of
https://github.com/github/codeql.git
synced 2026-04-27 17:55:19 +02:00
Ruby: Use lookupMethod
The hope is that this predicate is already used elsewhere, so its cost is amortized.
This commit is contained in:
@@ -9,6 +9,7 @@ private import codeql.ruby.controlflow.CfgNodes::ExprNodes
|
||||
private import codeql.ruby.DataFlow
|
||||
private import codeql.ruby.dataflow.internal.DataFlowPrivate as DataFlowPrivate
|
||||
private import codeql.ruby.ast.internal.Constant
|
||||
private import codeql.ruby.ast.internal.Module
|
||||
|
||||
/**
|
||||
* Provides modeling for ActionController filters.
|
||||
@@ -109,7 +110,7 @@ module Filters {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the callable that implements the filter with name `name`.
|
||||
* Gets the callable that implements a filter registered by this call.
|
||||
* This currently only finds methods in the local class or superclass.
|
||||
* It doesn't handle:
|
||||
* - lambdas
|
||||
@@ -127,9 +128,8 @@ module Filters {
|
||||
* ```
|
||||
*/
|
||||
Callable getAFilterCallable() {
|
||||
this.getFilterArgumentName() = result.(MethodBase).getName() and
|
||||
result.getEnclosingModule().getModule() =
|
||||
this.getExpr().getEnclosingModule().getModule().getAnAncestor()
|
||||
result =
|
||||
lookupMethod(this.getExpr().getEnclosingModule().getModule(), this.getFilterArgumentName())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user