JS: replace .stripParens library uses w. .getUnderlyingReference

This commit is contained in:
Esben Sparre Andreasen
2018-10-15 09:49:35 +02:00
parent 43e215c7af
commit f04293f73c
3 changed files with 4 additions and 4 deletions

View File

@@ -71,7 +71,7 @@ private predicate defn(ControlFlowNode def, Expr lhs, AST::ValueNode rhs) {
private predicate defn(ControlFlowNode def, Expr lhs) {
defn(def, lhs, _) or
lhs = def.(CompoundAssignExpr).getTarget() or
lhs = def.(UpdateExpr).getOperand().stripParens() or
lhs = def.(UpdateExpr).getOperand().getUnderlyingReference() or
lhs = def.(ImportSpecifier).getLocal() or
exists (EnhancedForLoop efl | def = efl.getIteratorExpr() |
lhs = def.(Expr).stripParens() or
@@ -143,7 +143,7 @@ class RValue extends RefExpr {
not this instanceof LValue and not this instanceof VarDecl or
// in `x++` and `x += 1`, `x` is both RValue and LValue
this = any(CompoundAssignExpr a).getTarget() or
this = any(UpdateExpr u).getOperand().stripParens() or
this = any(UpdateExpr u).getOperand().getUnderlyingReference() or
this = any(NamespaceDeclaration decl).getId()
}
}

View File

@@ -319,7 +319,7 @@ class VarAccess extends @varaccess, VarRef, LexicalAccess {
override predicate isLValue() {
exists (Assignment assgn | assgn.getTarget() = this) or
exists (UpdateExpr upd | upd.getOperand().stripParens() = this) or
exists (UpdateExpr upd | upd.getOperand().getUnderlyingReference() = this) or
exists (EnhancedForLoop efl | efl.getIterator() = this) or
exists (BindingPattern p | this = p.getABindingVarRef() and p.isLValue())
}

View File

@@ -125,7 +125,7 @@ abstract class SourceNode extends DataFlow::Node {
*/
DataFlow::CallNode getAMethodCall(string methodName) {
exists (PropAccess pacc |
pacc = result.getCalleeNode().asExpr().stripParens() and
pacc = result.getCalleeNode().asExpr().getUnderlyingReference() and
flowsToExpr(pacc.getBase()) and
pacc.getPropertyName() = methodName
)