mirror of
https://github.com/github/codeql.git
synced 2025-12-24 04:36:35 +01:00
Ruby: Expose relevant predicates from internal/Module.qll and make sure they are cached
This commit is contained in:
@@ -11,7 +11,6 @@
|
||||
*/
|
||||
|
||||
import codeql.ruby.AST
|
||||
import codeql.ruby.ast.internal.Module
|
||||
import codeql.ruby.dataflow.SSA
|
||||
|
||||
from DefLoc loc, Expr src, Expr target, string kind
|
||||
@@ -36,7 +35,7 @@ select src, target, kind
|
||||
newtype DefLoc =
|
||||
/** A constant, module or class. */
|
||||
ConstantDefLoc(ConstantReadAccess read, ConstantWriteAccess write) {
|
||||
write = definitionOf(resolveConstant(read))
|
||||
write = definitionOf(read.getAQualifiedName())
|
||||
} or
|
||||
/** A method call. */
|
||||
MethodLoc(MethodCall call, Method meth) { meth = call.getATarget() } or
|
||||
@@ -75,7 +74,7 @@ newtype DefLoc =
|
||||
*/
|
||||
pragma[noinline]
|
||||
ConstantWriteAccess definitionOf(string fqn) {
|
||||
fqn = resolveConstant(_) and
|
||||
fqn = any(ConstantReadAccess read).getAQualifiedName() and
|
||||
result =
|
||||
min(ConstantWriteAccess w, Location l |
|
||||
w.getAQualifiedName() = fqn and l = w.getLocation()
|
||||
|
||||
Reference in New Issue
Block a user