cache AccessPath::getAnInstanceIn

This commit is contained in:
Erik Krogh Kristensen
2021-03-11 16:09:24 +01:00
parent 24b0469d74
commit 5afb7e05ee
2 changed files with 6 additions and 0 deletions

View File

@@ -16,6 +16,7 @@
*/
import javascript
private import semmle.javascript.internal.CachedStages
/**
* A representation of a property name that is either statically known or is
@@ -88,7 +89,9 @@ class AccessPath extends TAccessPath {
/**
* Gets an expression in `bb` represented by this access path.
*/
cached
Expr getAnInstanceIn(BasicBlock bb) {
Stages::DataFlowStage::ref() and
exists(SsaVariable var |
this = MkSsaRoot(var) and
result = getARefinementOf*(var).getAUseIn(bb)

View File

@@ -24,6 +24,7 @@ import javascript
private import StmtContainers
private import semmle.javascript.dataflow.internal.PreCallGraphStep
private import semmle.javascript.dataflow.internal.FlowSteps
private import semmle.javascript.dataflow.internal.AccessPaths
/**
* Contains a `cached module` for each stage.
@@ -130,6 +131,8 @@ module Stages {
any(DataFlow::Node node).hasLocationInfo(_, _, _, _, _)
or
exists(any(DataFlow::Node node).toString())
or
exists(any(AccessPath a).getAnInstanceIn(_))
}
}