mirror of
https://github.com/github/codeql.git
synced 2026-04-30 11:15:13 +02:00
don't depend on the callgraph in KernelArraySummary
This commit is contained in:
@@ -198,6 +198,8 @@ module Kernel {
|
||||
}
|
||||
}
|
||||
|
||||
private import codeql.ruby.ast.internal.Module as Module
|
||||
|
||||
/**
|
||||
* A call to `Array()`, that converts it's singular argument to an array.
|
||||
* This summary is based on https://ruby-doc.org/3.2.1/Kernel.html#method-i-Array
|
||||
@@ -205,11 +207,12 @@ module Kernel {
|
||||
private class KernelArraySummary extends SummarizedCallable {
|
||||
KernelArraySummary() { this = "Array()" }
|
||||
|
||||
override MethodCall getACall() {
|
||||
override MethodCall getACallSimple() {
|
||||
result.getMethodName() = "Array" and
|
||||
// I have to have a simplified "KernelMethodCall" implementation inlined here, because relying on `UnknownMethodCall` results in non-monotonic recursion (even if using `getACall`).
|
||||
(
|
||||
result = API::getTopLevelMember("Kernel").getAMethodCall(_).asExpr().getExpr()
|
||||
// similar to `getAStaticArrayCall` from Array.qll
|
||||
Module::resolveConstantReadAccess(result.getReceiver()) = Module::TResolved("Kernel")
|
||||
or
|
||||
result.getReceiver() instanceof SelfVariableAccess
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user