mirror of
https://github.com/github/codeql.git
synced 2026-04-27 01:35:13 +02:00
Ruby: use lambdaCreation and handle "proc" in there
This commit is contained in:
@@ -1300,7 +1300,7 @@ predicate lambdaCreation(Node creation, LambdaCallKind kind, DataFlowCallable c)
|
||||
creation.asExpr() =
|
||||
any(CfgNodes::ExprNodes::MethodCallCfgNode mc |
|
||||
c.asCallable() = mc.getBlock().getExpr() and
|
||||
mc.getExpr().getMethodName() = "lambda"
|
||||
mc.getExpr().getMethodName() = ["lambda", "proc"]
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -73,11 +73,9 @@ class Node extends TNode {
|
||||
CallableNode asCallable() {
|
||||
result = this
|
||||
or
|
||||
exists(CallNode call |
|
||||
call.getReceiver().asExpr().getExpr() instanceof SelfVariableAccess and
|
||||
call.getMethodName() = ["proc", "lambda"] and
|
||||
call.getBlock() = result and
|
||||
this = call
|
||||
exists(DataFlowCallable c |
|
||||
lambdaCreation(this, _, c) and
|
||||
result.asCallableAstNode() = c.asCallable()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user