JS: replace .stripParens query uses w. .getUnderlyingReference

This commit is contained in:
Esben Sparre Andreasen
2018-10-15 09:56:38 +02:00
parent f04293f73c
commit e6a190c06e
4 changed files with 5 additions and 5 deletions

View File

@@ -26,7 +26,7 @@ class IncrementExpr extends Expr {
// x = x + e
exists (AssignExpr assgn, Variable v | assgn = this |
assgn.getTarget() = v.getAnAccess() and
assgn.getRhs().(AddExpr).getAnOperand().stripParens() = v.getAnAccess()
assgn.getRhs().(AddExpr).getAnOperand().getUnderlyingReference() = v.getAnAccess()
)
}
}

View File

@@ -28,7 +28,7 @@ import semmle.javascript.dataflow.Refinements
*/
predicate isDefensiveInit(VarAccess va) {
exists (LogOrExpr o, VarRef va2 |
va = o.getLeftOperand().stripParens() and va2.getVariable() = va.getVariable() |
va = o.getLeftOperand().getUnderlyingReference() and va2.getVariable() = va.getVariable() |
exists (AssignExpr assgn | va2 = assgn.getTarget() |
assgn = o.getRightOperand().stripParens() or
o = assgn.getRhs().getUnderlyingValue()