File tree Expand file tree Collapse file tree 3 files changed +27
-0
lines changed
src/semmle/javascript/dataflow
test/library-tests/frameworks/EventEmitter Expand file tree Collapse file tree 3 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -1196,6 +1196,14 @@ module ClassNode {
1196
1196
getAPropertySource ( "prototype" ) = newCall and
1197
1197
result = newCall .getCalleeNode ( )
1198
1198
)
1199
+ or
1200
+ // util.inherits(C, D);
1201
+ exists ( DataFlow:: CallNode inheritsCall |
1202
+ inheritsCall = DataFlow:: moduleMember ( "util" , "inherits" ) .getACall ( )
1203
+ |
1204
+ this = inheritsCall .getArgument ( 0 ) .getALocalSource ( ) and
1205
+ result = inheritsCall .getArgument ( 1 )
1206
+ )
1199
1207
}
1200
1208
}
1201
1209
}
Original file line number Diff line number Diff line change 4
4
| customEmitter.js:18:15:18:20 | "baz2" | customEmitter.js:13:23:13:26 | data |
5
5
| customEmitter.js:21:15:21:20 | "baz3" | customEmitter.js:13:23:13:26 | data |
6
6
| customEmitter.js:21:15:21:20 | "baz3" | customEmitter.js:22:14:22:18 | yData |
7
+ | tst2.js:18:16:18:20 | "bar" | tst2.js:17:14:17:16 | bar |
7
8
| tst.js:9:23:9:33 | 'FirstData' | tst.js:6:40:6:44 | first |
8
9
| tst.js:10:24:10:35 | 'SecondData' | tst.js:7:32:7:37 | second |
9
10
| tst.js:15:24:15:39 | 'OtherFirstData' | tst.js:14:41:14:50 | otherFirst |
Original file line number Diff line number Diff line change
1
+ var util = require ( 'util' ) ;
2
+ var EventEmitter = require ( 'events' ) . EventEmitter ;
3
+
4
+ var Connector = function ( ) {
5
+ if ( ! ( this instanceof Connector ) ) {
6
+ return new Connector ( port , host , opts ) ;
7
+ }
8
+
9
+ EventEmitter . call ( this ) ;
10
+ } ;
11
+
12
+ util . inherits ( Connector , EventEmitter ) ;
13
+
14
+ Connector . prototype . foo = function ( ) { } ;
15
+
16
+ var em = new Connector ( ) ;
17
+ em . on ( "foo" , bar => { } ) ;
18
+ em . emit ( "foo" , "bar" ) ;
You can’t perform that action at this time.
0 commit comments