Skip to content

Commit 5afb7e0

Browse files
committed
cache AccessPath::getAnInstanceIn
1 parent 24b0469 commit 5afb7e0

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

javascript/ql/src/semmle/javascript/dataflow/internal/AccessPaths.qll

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
*/
1717

1818
import javascript
19+
private import semmle.javascript.internal.CachedStages
1920

2021
/**
2122
* A representation of a property name that is either statically known or is
@@ -88,7 +89,9 @@ class AccessPath extends TAccessPath {
8889
/**
8990
* Gets an expression in `bb` represented by this access path.
9091
*/
92+
cached
9193
Expr getAnInstanceIn(BasicBlock bb) {
94+
Stages::DataFlowStage::ref() and
9295
exists(SsaVariable var |
9396
this = MkSsaRoot(var) and
9497
result = getARefinementOf*(var).getAUseIn(bb)

javascript/ql/src/semmle/javascript/internal/CachedStages.qll

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import javascript
2424
private import StmtContainers
2525
private import semmle.javascript.dataflow.internal.PreCallGraphStep
2626
private import semmle.javascript.dataflow.internal.FlowSteps
27+
private import semmle.javascript.dataflow.internal.AccessPaths
2728

2829
/**
2930
* Contains a `cached module` for each stage.
@@ -130,6 +131,8 @@ module Stages {
130131
any(DataFlow::Node node).hasLocationInfo(_, _, _, _, _)
131132
or
132133
exists(any(DataFlow::Node node).toString())
134+
or
135+
exists(any(AccessPath a).getAnInstanceIn(_))
133136
}
134137
}
135138

0 commit comments

Comments
 (0)