mirror of
https://github.com/github/codeql.git
synced 2026-05-04 13:15:21 +02:00
JS: address some review comments
This commit is contained in:
@@ -174,8 +174,9 @@ string getTypeDescription(string message1, string message2, int complexity1, int
|
||||
* Holds if `e` directly uses a parameter's initial value as passed in from the caller.
|
||||
*/
|
||||
predicate isInitialParameterUse(Expr e) {
|
||||
// unlike `SimpleParameter.getAnInitialUse` this will not include uses we have refinement information for
|
||||
exists (SimpleParameter p, SsaExplicitDefinition ssa |
|
||||
ssa.getAContributingVarDef() = p and
|
||||
ssa.getDef() = p and
|
||||
ssa.getVariable().getAUse() = e and
|
||||
not p.isRestParameter()
|
||||
)
|
||||
|
||||
@@ -67,8 +67,9 @@ predicate isConstant(Expr e) {
|
||||
* Holds if `e` directly uses a parameter's initial value as passed in from the caller.
|
||||
*/
|
||||
predicate isInitialParameterUse(Expr e) {
|
||||
// unlike `SimpleParameter.getAnInitialUse` this will not include uses we have refinement information for
|
||||
exists (SimpleParameter p, SsaExplicitDefinition ssa |
|
||||
ssa.getAContributingVarDef() = p and
|
||||
ssa.getDef() = p and
|
||||
ssa.getVariable().getAUse() = e and
|
||||
not p.isRestParameter()
|
||||
)
|
||||
@@ -80,9 +81,11 @@ predicate isInitialParameterUse(Expr e) {
|
||||
* Holds if `e` directly uses the returned value from a function call that returns a constant boolean value.
|
||||
*/
|
||||
predicate isConstantBooleanReturnValue(Expr e) {
|
||||
// unlike `SourceNode.flowsTo` this will not include uses we have refinement information for
|
||||
exists (DataFlow::CallNode call |
|
||||
exists (call.analyze().getTheBooleanValue()) |
|
||||
e = call.asExpr() or
|
||||
// also support return values that are assigned to variables
|
||||
exists (SsaExplicitDefinition ssa |
|
||||
ssa.getDef().getSource() = call.asExpr() and
|
||||
ssa.getVariable().getAUse() = e
|
||||
|
||||
@@ -191,7 +191,7 @@ private class IIFEWithAnalyzedReturnFlow extends CallWithAnalyzedReturnFlow {
|
||||
ImmediatelyInvokedFunctionExpr iife;
|
||||
|
||||
IIFEWithAnalyzedReturnFlow() {
|
||||
this.asExpr() = iife.getInvocation()
|
||||
astNode = iife.getInvocation()
|
||||
}
|
||||
|
||||
override Function getAFunction() {
|
||||
|
||||
Reference in New Issue
Block a user