Skip to content

Commit 82fb5e9

Browse files
committed
JS: Moving 'cache' annotations outside the parameterised module
1 parent 7a3ecc7 commit 82fb5e9

File tree

1 file changed

+30
-8
lines changed

1 file changed

+30
-8
lines changed

javascript/ql/lib/semmle/javascript/ApiGraphs.qll

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -803,7 +803,6 @@ module API {
803803
predicate inScope(DataFlow::Node node);
804804
}
805805

806-
cached
807806
private module Stage<StageInputSig S> {
808807
/**
809808
* Holds if `rhs` is the right-hand side of a definition of a node that should have an
@@ -995,7 +994,6 @@ module API {
995994
/**
996995
* Holds if `rhs` is the right-hand side of a definition of node `nd`.
997996
*/
998-
cached
999997
predicate rhs(TApiNode nd, DataFlow::Node rhs) {
1000998
(S::inScope(rhs) or S::isAdditionalDefRoot(nd)) and
1001999
exists(string m | nd = MkModuleExport(m) | exports(m, rhs))
@@ -1242,7 +1240,6 @@ module API {
12421240
/**
12431241
* Holds if `ref` is a use of node `nd`.
12441242
*/
1245-
cached
12461243
predicate use(TApiNode nd, DataFlow::Node ref) {
12471244
(S::inScope(ref) or S::isAdditionalUseRoot(nd)) and
12481245
(
@@ -1364,7 +1361,6 @@ module API {
13641361
/**
13651362
* Gets a node that is inter-procedurally reachable from `nd`, which is a use of some node.
13661363
*/
1367-
cached
13681364
DataFlow::SourceNode trackUseNode(DataFlow::SourceNode nd) {
13691365
result = trackUseNode(nd, false, 0, "")
13701366
}
@@ -1415,7 +1411,6 @@ module API {
14151411
/**
14161412
* Gets a node that inter-procedurally flows into `nd`, which is a definition of some node.
14171413
*/
1418-
cached
14191414
DataFlow::SourceNode trackDefNode(DataFlow::Node nd) {
14201415
result = trackDefNode(nd, DataFlow::TypeBackTracker::end())
14211416
}
@@ -1438,7 +1433,6 @@ module API {
14381433
/**
14391434
* Holds if there is an edge from `pred` to `succ` in the API graph that is labeled with `lbl`.
14401435
*/
1441-
cached
14421436
predicate edge(TApiNode pred, Label::ApiLabel lbl, TApiNode succ) {
14431437
Stages::ApiStage::ref() and
14441438
exists(string m |
@@ -1504,7 +1498,6 @@ module API {
15041498
* Gets a call to a promisified function represented by `callee` where
15051499
* `bound` arguments have been bound.
15061500
*/
1507-
cached
15081501
DataFlow::InvokeNode getAPromisifiedInvocation(TApiNode callee, int bound, TApiNode succ) {
15091502
exists(DataFlow::SourceNode src |
15101503
use(callee, src) and
@@ -1525,7 +1518,36 @@ module API {
15251518
predicate inScope(DataFlow::Node node) { any() }
15261519
}
15271520

1528-
import Stage<Stage1Input>
1521+
private module Stage1 = Stage<Stage1Input>;
1522+
1523+
cached
1524+
private module Cached {
1525+
cached
1526+
predicate rhs(TApiNode nd, DataFlow::Node rhs) { Stage1::rhs(nd, rhs) }
1527+
1528+
cached
1529+
predicate use(TApiNode nd, DataFlow::Node ref) { Stage1::use(nd, ref) }
1530+
1531+
cached
1532+
DataFlow::SourceNode trackUseNode(DataFlow::SourceNode nd) {
1533+
result = Stage1::trackUseNode(nd)
1534+
}
1535+
1536+
cached
1537+
DataFlow::SourceNode trackDefNode(DataFlow::Node nd) { result = Stage1::trackDefNode(nd) }
1538+
1539+
cached
1540+
predicate edge(TApiNode pred, Label::ApiLabel lbl, TApiNode succ) {
1541+
Stage1::edge(pred, lbl, succ)
1542+
}
1543+
1544+
cached
1545+
DataFlow::InvokeNode getAPromisifiedInvocation(TApiNode callee, int bound, TApiNode succ) {
1546+
result = Stage1::getAPromisifiedInvocation(callee, bound, succ)
1547+
}
1548+
}
1549+
1550+
import Cached
15291551

15301552
/**
15311553
* Holds if there is an edge from `pred` to `succ` in the API graph.

0 commit comments

Comments
 (0)