mirror of
https://github.com/github/codeql.git
synced 2026-04-27 01:35:13 +02:00
Address review comments
This commit is contained in:
@@ -201,7 +201,11 @@ module ExprNodes {
|
||||
|
||||
override LhsExpr getExpr() { result = super.getExpr() }
|
||||
|
||||
/** Gets a variable used in (or introduced by) this LHS. */
|
||||
/**
|
||||
* DEPRECATED: use `getVariable` instead.
|
||||
*
|
||||
* Gets a variable used in (or introduced by) this LHS.
|
||||
*/
|
||||
deprecated Variable getAVariable() { result = e.(VariableAccess).getVariable() }
|
||||
|
||||
/** Gets the variable used in (or introduced by) this LHS. */
|
||||
|
||||
@@ -163,7 +163,7 @@ class RequiredSummaryComponentStack = Impl::Public::RequiredSummaryComponentStac
|
||||
|
||||
/**
|
||||
* Provides a set of special flow summaries to ensure that callbacks passed into
|
||||
* library methods will be passed as `self` arguments into themeselves. That is,
|
||||
* library methods will be passed as `lambda-self` arguments into themselves. That is,
|
||||
* we are assuming that callbacks passed into library methods will be called, which is
|
||||
* needed for flow through captured variables.
|
||||
*/
|
||||
@@ -172,21 +172,6 @@ private module LibraryCallbackSummaries {
|
||||
not exists(getTarget(call))
|
||||
}
|
||||
|
||||
private class LibraryBlockMethod extends SummarizedCallable {
|
||||
LibraryBlockMethod() { this = "<library method accepting a block>" }
|
||||
|
||||
final override MethodCall getACall() {
|
||||
libraryCall(result.getAControlFlowNode()) and
|
||||
result.hasBlock()
|
||||
}
|
||||
|
||||
override predicate propagatesFlowExt(string input, string output, boolean preservesValue) {
|
||||
input = "Argument[block]" and
|
||||
output = "Argument[block].Parameter[lambda-self]" and
|
||||
preservesValue = true
|
||||
}
|
||||
}
|
||||
|
||||
private DataFlow::LocalSourceNode trackLambdaCreation(TypeTracker t) {
|
||||
t.start() and
|
||||
lambdaCreation(result, TLambdaCallKind(), _)
|
||||
@@ -205,20 +190,26 @@ private module LibraryCallbackSummaries {
|
||||
}
|
||||
|
||||
private class LibraryLambdaMethod extends SummarizedCallable {
|
||||
private int i;
|
||||
|
||||
LibraryLambdaMethod() {
|
||||
this = "<library method accepting a lambda at index " + i + ">" and
|
||||
i in [0 .. 10]
|
||||
}
|
||||
LibraryLambdaMethod() { this = "<library method accepting a callback>" }
|
||||
|
||||
final override MethodCall getACall() {
|
||||
libraryCallHasLambdaArg(result.getAControlFlowNode(), i)
|
||||
libraryCall(result.getAControlFlowNode()) and
|
||||
result.hasBlock()
|
||||
or
|
||||
libraryCallHasLambdaArg(result.getAControlFlowNode(), _)
|
||||
}
|
||||
|
||||
override predicate propagatesFlowExt(string input, string output, boolean preservesValue) {
|
||||
input = "Argument[" + i + "]" and
|
||||
output = "Argument[" + i + "].Parameter[lambda-self]" and
|
||||
(
|
||||
input = "Argument[block]" and
|
||||
output = "Argument[block].Parameter[lambda-self]"
|
||||
or
|
||||
exists(int i |
|
||||
i in [0 .. 10] and
|
||||
input = "Argument[" + i + "]" and
|
||||
output = "Argument[" + i + "].Parameter[lambda-self]"
|
||||
)
|
||||
) and
|
||||
preservesValue = true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1219,7 +1219,11 @@ class LhsExprNode extends ExprNode {
|
||||
/** Gets the underlying AST node as a `LhsExpr`. */
|
||||
LhsExpr asLhsExprAstNode() { result = lhsExprCfgNode.getExpr() }
|
||||
|
||||
/** Gets a variable used in (or introduced by) this LHS. */
|
||||
/**
|
||||
* DEPRECATED: use `getVariable` instead.
|
||||
*
|
||||
* Gets a variable used in (or introduced by) this LHS.
|
||||
*/
|
||||
deprecated Variable getAVariable() { result = lhsExprCfgNode.getAVariable() }
|
||||
|
||||
/** Gets the variable used in (or introduced by) this LHS. */
|
||||
|
||||
Reference in New Issue
Block a user