Skip to content

Commit 8e1dac0

Browse files
committed
JS: Rename "in scope" to "in active file"
1 parent 1bfbe41 commit 8e1dac0

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

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

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -823,14 +823,15 @@ module API {
823823
predicate isAdditionalDefRoot(Node node);
824824

825825
/**
826-
* Holds if `node` is considered "in scope" for this stage, meaning that we allow outgoing labelled edges
826+
* Holds if `node` is in a file that is considered "active" in this stage, meaning that we allow outgoing labelled edges
827827
* to be materialised from here, and continue API graph construction from the successors' edges.
828828
*
829-
* Note that the "additional roots" contributed by the stage inputs may be out of scope but can be tracked to a node in scope.
829+
* Note that the "additional roots" contributed by the stage inputs may be in an inactive file but can be tracked to a node in an
830+
* active file.
830831
* This predicate should thus not be used to block the tracking of use/def nodes, but only block the creation of new labelled edges.
831832
*/
832833
bindingset[node]
833-
predicate inScope(DataFlow::Node node);
834+
predicate inActiveFile(DataFlow::Node node);
834835
}
835836

836837
private module Stage<StageInputSig S> {
@@ -1025,11 +1026,11 @@ module API {
10251026
* Holds if `rhs` is the right-hand side of a definition of node `nd`.
10261027
*/
10271028
predicate rhs(TApiNode nd, DataFlow::Node rhs) {
1028-
(S::inScope(rhs) or S::isAdditionalDefRoot(nd)) and
1029+
(S::inActiveFile(rhs) or S::isAdditionalDefRoot(nd)) and
10291030
exists(string m | nd = MkModuleExport(m) | exports(m, rhs))
10301031
or
10311032
rhs(_, _, rhs) and
1032-
S::inScope(rhs) and
1033+
S::inActiveFile(rhs) and
10331034
nd = MkDef(rhs)
10341035
or
10351036
S::isAdditionalDefRoot(nd) and
@@ -1084,7 +1085,7 @@ module API {
10841085
exists(EntryPoint e |
10851086
lbl = Label::entryPoint(e) and
10861087
ref = e.getASource() and
1087-
S::inScope(ref)
1088+
S::inActiveFile(ref)
10881089
)
10891090
or
10901091
// property reads
@@ -1286,7 +1287,7 @@ module API {
12861287
* Holds if `ref` is a use of node `nd`.
12871288
*/
12881289
predicate use(TApiNode nd, DataFlow::Node ref) {
1289-
(S::inScope(ref) or S::isAdditionalUseRoot(nd)) and
1290+
(S::inActiveFile(ref) or S::isAdditionalUseRoot(nd)) and
12901291
(
12911292
exists(string m, Module mod | nd = MkModuleDef(m) and mod = importableModule(m) |
12921293
ref = DataFlow::moduleVarNode(mod)
@@ -1313,7 +1314,7 @@ module API {
13131314
)
13141315
or
13151316
use(_, _, ref) and
1316-
S::inScope(ref) and
1317+
S::inActiveFile(ref) and
13171318
nd = MkUse(ref)
13181319
or
13191320
S::isAdditionalUseRoot(nd) and
@@ -1590,7 +1591,7 @@ module API {
15901591
private predicate isOverlay() { databaseMetadata("isOverlay", "true") }
15911592

15921593
bindingset[node]
1593-
predicate inScope(DataFlow::Node node) {
1594+
predicate inActiveFile(DataFlow::Node node) {
15941595
// In the base database, compute everything in stage 1.
15951596
// In an overlay database, do nothing in stage 1.
15961597
not isOverlay() and exists(node)
@@ -1691,7 +1692,7 @@ module API {
16911692
}
16921693

16931694
bindingset[node]
1694-
predicate inScope(DataFlow::Node node) { isInOverlayChangedFile(node) }
1695+
predicate inActiveFile(DataFlow::Node node) { isInOverlayChangedFile(node) }
16951696
}
16961697

16971698
private module Stage2 = Stage<Stage2Input>;
@@ -1754,7 +1755,7 @@ module API {
17541755
predicate isAdditionalDefRoot(Node node) { none() }
17551756

17561757
bindingset[node]
1757-
predicate inScope(DataFlow::Node node) { any() }
1758+
predicate inActiveFile(DataFlow::Node node) { any() }
17581759
}
17591760

17601761
private module Full = Stage<FullInput>;

0 commit comments

Comments
 (0)