Skip to content

Commit 9c6b698

Browse files
committed
JS: Add test to restrict dependencies
1 parent 2f0c80a commit 9c6b698

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
| pass |
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/**
2+
* Test that fails with a compilation error if `getACallSimple` depends on the call graph.
3+
* To do this, we add a negative dependency from the call graph to `getACallSimple`.
4+
*/
5+
6+
import javascript
7+
import semmle.javascript.dataflow.internal.StepSummary
8+
import semmle.javascript.dataflow.FlowSummary
9+
10+
class NegativeDependency extends DataFlow::SharedTypeTrackingStep {
11+
override predicate step(DataFlow::Node node1, DataFlow::Node node2) {
12+
exists(SummarizedCallable callable |
13+
not exists(callable.getACallSimple()) and
14+
node1 = node2
15+
)
16+
}
17+
}
18+
19+
select "pass"

0 commit comments

Comments
 (0)