Address review comments

This commit is contained in:
Tom Hvitved
2023-08-31 08:57:41 +02:00
parent 6de315d086
commit a06a9ffa29
3 changed files with 26 additions and 27 deletions

View File

@@ -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. */

View File

@@ -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
}
}

View File

@@ -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. */