Skip to content

Commit 4705d30

Browse files
committed
Add call graph tests for prototype methods injected on class
1 parent c571721 commit 4705d30

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

javascript/ql/test/library-tests/CallGraphs/AnnotatedTest/Test.expected

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ spuriousCallee
22
missingCallee
33
| constructor-field.ts:40:5:40:14 | f3.build() | constructor-field.ts:13:3:13:12 | build() {} | -1 | calls |
44
| constructor-field.ts:71:1:71:11 | bf3.build() | constructor-field.ts:13:3:13:12 | build() {} | -1 | calls |
5+
| prototypes.js:19:3:19:13 | baz.shout() | prototypes.js:11:23:11:35 | function() {} | -1 | calls |
56
badAnnotation
67
accessorCall
78
| accessors.js:12:1:12:5 | obj.f | accessors.js:5:8:5:12 | () {} |
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
class Baz {
2+
baz() {
3+
/** calls:Baz.greet */
4+
this.greet();
5+
}
6+
/** name:Baz.greet */
7+
greet() {}
8+
}
9+
10+
/** name:Baz.shout */
11+
Baz.prototype.shout = function() {};
12+
/** name:Baz.staticShout */
13+
Baz.staticShout = function() {};
14+
15+
function foo(baz){
16+
/** calls:Baz.greet */
17+
baz.greet();
18+
/** calls:Baz.shout */
19+
baz.shout();
20+
/** calls:Baz.staticShout */
21+
Baz.staticShout();
22+
}
23+
24+
const baz = new Baz();
25+
foo(baz);

0 commit comments

Comments
 (0)