File tree Expand file tree Collapse file tree 1 file changed +65
-0
lines changed
javascript/ql/test/library-tests/TripleDot Expand file tree Collapse file tree 1 file changed +65
-0
lines changed Original file line number Diff line number Diff line change 1+ import 'dummy' ;
2+
3+ function e1 ( ) {
4+ let array = [ source ( 'e1.1' ) ] ;
5+ try {
6+ array . forEach ( x => {
7+ throw x ;
8+ } ) ;
9+ array . forEach ( x => {
10+ throw source ( 'e1.2' ) ;
11+ } ) ;
12+ } catch ( err ) {
13+ sink ( err ) ; // $ hasValueFlow=e1.2 hasValueFlow=e1.1
14+ }
15+ }
16+
17+ function e2 ( ) {
18+ let array = [ source ( 'e2.1' ) ] ;
19+ try {
20+ array . unknown ( x => {
21+ throw x ;
22+ } ) ;
23+ array . unknown ( x => {
24+ throw source ( 'e2.2' ) ;
25+ } ) ;
26+ } catch ( err ) {
27+ sink ( err ) ; // $ MISSING: hasValueFlow=e2.2
28+ }
29+ }
30+
31+ function e3 ( ) {
32+ const events = getSomething ( ) ;
33+ try {
34+ events . addEventListener ( 'click' , ( ) => {
35+ throw source ( 'e3.1' ) ;
36+ } ) ;
37+ events . addListener ( 'click' , ( ) => {
38+ throw source ( 'e3.2' ) ;
39+ } ) ;
40+ events . on ( 'click' , ( ) => {
41+ throw source ( 'e3.3' ) ;
42+ } ) ;
43+ events . unknownMethod ( 'click' , ( ) => {
44+ throw source ( 'e3.4' ) ;
45+ } ) ;
46+ } catch ( err ) {
47+ sink ( err ) ; // $ MISSING: hasValueFlow=e3.4
48+ }
49+ }
50+
51+ function e4 ( ) {
52+ function thrower ( array ) {
53+ array . forEach ( x => { throw x } ) ;
54+ }
55+ try {
56+ thrower ( [ source ( "e4.1" ) ] ) ;
57+ } catch ( e ) {
58+ sink ( e ) ; // $ hasValueFlow=e4.1
59+ }
60+ try {
61+ thrower ( [ "safe" ] ) ;
62+ } catch ( e ) {
63+ sink ( e ) ; // $ SPURIOUS: hasValueFlow=e4.1
64+ }
65+ }
You can’t perform that action at this time.
0 commit comments