JS: Cache PropRef.getBase

This commit is contained in:
Asger Feldthaus
2021-03-26 10:48:25 +00:00
parent e13a9c9716
commit cc2a531684
2 changed files with 7 additions and 1 deletions

View File

@@ -492,6 +492,7 @@ module DataFlow {
* Gets the data flow node corresponding to the base object
* whose property is read from or written to.
*/
cached
abstract Node getBase();
/**
@@ -595,7 +596,10 @@ module DataFlow {
PropLValueAsPropWrite() { astNode instanceof LValue }
override Node getBase() { result = valueNode(astNode.getBase()) }
override Node getBase() {
result = valueNode(astNode.getBase()) and
Stages::DataFlowStage::ref()
}
override Expr getPropertyNameExpr() { result = astNode.getPropertyNameExpr() }

View File

@@ -133,6 +133,8 @@ module Stages {
exists(any(DataFlow::Node node).toString())
or
exists(any(AccessPath a).getAnInstanceIn(_))
or
exists(any(DataFlow::PropRef ref).getBase())
}
}