File tree Expand file tree Collapse file tree 3 files changed +46
-5
lines changed
javascript/ql/test/library-tests/Generators Expand file tree Collapse file tree 3 files changed +46
-5
lines changed Original file line number Diff line number Diff line change 1+ legacyDataFlowDifference
2+ | generators.js:2:16:2:23 | "source" | generators.js:37:10:37:10 | e | only flow with OLD data flow library |
3+ | generators.js:2:16:2:23 | "source" | generators.js:46:10:46:10 | e | only flow with NEW data flow library |
4+ | generators.js:2:16:2:23 | "source" | generators.js:51:10:51:10 | e | only flow with NEW data flow library |
5+ consistencyIssue
Original file line number Diff line number Diff line change 11import javascript
22import testUtilities.ConsistencyChecking
33
4- class GeneratorFlowConfig extends DataFlow:: Configuration {
5- GeneratorFlowConfig ( ) { this = "GeneratorFlowConfig " }
4+ module TestConfig implements DataFlow:: ConfigSig {
5+ predicate isSource ( DataFlow :: Node source ) { source . asExpr ( ) . getStringValue ( ) = "source " }
66
7- override predicate isSource ( DataFlow:: Node source ) { source .asExpr ( ) .getStringValue ( ) = "source" }
8-
9- override predicate isSink ( DataFlow:: Node sink ) {
7+ predicate isSink ( DataFlow:: Node sink ) {
108 sink = any ( DataFlow:: CallNode call | call .getCalleeName ( ) = "sink" ) .getAnArgument ( )
119 }
1210}
11+
12+ module TestFlow = DataFlow:: Global< TestConfig > ;
13+
14+ class LegacyConfig extends DataFlow:: Configuration {
15+ LegacyConfig ( ) { this = "GeneratorFlowConfig" }
16+
17+ override predicate isSource ( DataFlow:: Node source ) { TestConfig:: isSource ( source ) }
18+
19+ override predicate isSink ( DataFlow:: Node sink ) { TestConfig:: isSink ( sink ) }
20+ }
21+
22+ import testUtilities.LegacyDataFlowDiff:: DataFlowDiff< TestFlow , LegacyConfig >
23+
24+ class Consistency extends ConsistencyConfiguration {
25+ Consistency ( ) { this = "Consistency" }
26+
27+ override DataFlow:: Node getAnAlert ( ) { TestFlow:: flowTo ( result ) }
28+ }
Original file line number Diff line number Diff line change 3131 sink ( e ) ; // NOT OK
3232 }
3333
34+ try {
35+ gen4 ( ) ;
36+ } catch ( e ) {
37+ sink ( e ) ; // OK - exception is only thrown upon iteration
38+ }
39+
40+ const iterator = gen4 ( ) ;
41+ try {
42+ for ( let v of iterator ) {
43+ sink ( v ) ; // OK
44+ }
45+ } catch ( e ) {
46+ sink ( e ) ; // NOT OK
47+ }
48+ try {
49+ Array . from ( iterator ) ;
50+ } catch ( e ) {
51+ sink ( e ) ; // NOT OK
52+ }
53+
3454 function * delegating ( ) {
3555 yield * delegate ( ) ;
3656 }
You can’t perform that action at this time.
0 commit comments