JS: address some review comments

This commit is contained in:
Esben Sparre Andreasen
2018-08-17 18:25:56 +02:00
parent 21c895368d
commit ac947f10e7
3 changed files with 7 additions and 3 deletions

View File

@@ -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()
)

View File

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

View File

@@ -191,7 +191,7 @@ private class IIFEWithAnalyzedReturnFlow extends CallWithAnalyzedReturnFlow {
ImmediatelyInvokedFunctionExpr iife;
IIFEWithAnalyzedReturnFlow() {
this.asExpr() = iife.getInvocation()
astNode = iife.getInvocation()
}
override Function getAFunction() {