Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b69f853

Browse files
committed
JS: Moving 'cache' annotations outside the parameterised module
1 parent 10db30a commit b69f853

1 file changed

Lines changed: 30 additions & 8 deletions

File tree

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

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -818,7 +818,6 @@ module API {
818818
predicate inScope(DataFlow::Node node);
819819
}
820820

821-
cached
822821
private module Stage<StageInputSig S> {
823822
/**
824823
* Holds if `rhs` is the right-hand side of a definition of a node that should have an
@@ -1010,7 +1009,6 @@ module API {
10101009
/**
10111010
* Holds if `rhs` is the right-hand side of a definition of node `nd`.
10121011
*/
1013-
cached
10141012
predicate rhs(TApiNode nd, DataFlow::Node rhs) {
10151013
(S::inScope(rhs) or S::isAdditionalDefRoot(nd)) and
10161014
exists(string m | nd = MkModuleExport(m) | exports(m, rhs))
@@ -1258,7 +1256,6 @@ module API {
12581256
/**
12591257
* Holds if `ref` is a use of node `nd`.
12601258
*/
1261-
cached
12621259
predicate use(TApiNode nd, DataFlow::Node ref) {
12631260
(S::inScope(ref) or S::isAdditionalUseRoot(nd)) and
12641261
(
@@ -1380,7 +1377,6 @@ module API {
13801377
/**
13811378
* Gets a node that is inter-procedurally reachable from `nd`, which is a use of some node.
13821379
*/
1383-
cached
13841380
DataFlow::SourceNode trackUseNode(DataFlow::SourceNode nd) {
13851381
result = trackUseNode(nd, false, 0, "")
13861382
}
@@ -1431,7 +1427,6 @@ module API {
14311427
/**
14321428
* Gets a node that inter-procedurally flows into `nd`, which is a definition of some node.
14331429
*/
1434-
cached
14351430
DataFlow::SourceNode trackDefNode(DataFlow::Node nd) {
14361431
result = trackDefNode(nd, DataFlow::TypeBackTracker::end())
14371432
}
@@ -1454,7 +1449,6 @@ module API {
14541449
/**
14551450
* Holds if there is an edge from `pred` to `succ` in the API graph that is labeled with `lbl`.
14561451
*/
1457-
cached
14581452
predicate edge(TApiNode pred, Label::ApiLabel lbl, TApiNode succ) {
14591453
Stages::ApiStage::ref() and
14601454
exists(string m |
@@ -1520,7 +1514,6 @@ module API {
15201514
* Gets a call to a promisified function represented by `callee` where
15211515
* `bound` arguments have been bound.
15221516
*/
1523-
cached
15241517
DataFlow::InvokeNode getAPromisifiedInvocation(TApiNode callee, int bound, TApiNode succ) {
15251518
exists(DataFlow::SourceNode src |
15261519
use(callee, src) and
@@ -1541,7 +1534,36 @@ module API {
15411534
predicate inScope(DataFlow::Node node) { any() }
15421535
}
15431536

1544-
import Stage<Stage1Input>
1537+
private module Stage1 = Stage<Stage1Input>;
1538+
1539+
cached
1540+
private module Cached {
1541+
cached
1542+
predicate rhs(TApiNode nd, DataFlow::Node rhs) { Stage1::rhs(nd, rhs) }
1543+
1544+
cached
1545+
predicate use(TApiNode nd, DataFlow::Node ref) { Stage1::use(nd, ref) }
1546+
1547+
cached
1548+
DataFlow::SourceNode trackUseNode(DataFlow::SourceNode nd) {
1549+
result = Stage1::trackUseNode(nd)
1550+
}
1551+
1552+
cached
1553+
DataFlow::SourceNode trackDefNode(DataFlow::Node nd) { result = Stage1::trackDefNode(nd) }
1554+
1555+
cached
1556+
predicate edge(TApiNode pred, Label::ApiLabel lbl, TApiNode succ) {
1557+
Stage1::edge(pred, lbl, succ)
1558+
}
1559+
1560+
cached
1561+
DataFlow::InvokeNode getAPromisifiedInvocation(TApiNode callee, int bound, TApiNode succ) {
1562+
result = Stage1::getAPromisifiedInvocation(callee, bound, succ)
1563+
}
1564+
}
1565+
1566+
import Cached
15451567

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

0 commit comments

Comments
 (0)