Skip to content

Commit 7430d0e

Browse files
committed
Added failing test with method as field
1 parent c091743 commit 7430d0e

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ 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:117:5:117:19 | this.tmpClass() | prototypes.js:113:1:113:22 | functio ... ss() {} | -1 | calls |
6+
| prototypes.js:131:5:131:23 | this.tmpPrototype() | prototypes.js:127:1:127:26 | functio ... pe() {} | -1 | calls |
57
badAnnotation
68
accessorCall
79
| accessors.js:12:1:12:5 | obj.f | accessors.js:5:8:5:12 | () {} |

javascript/ql/test/library-tests/CallGraphs/AnnotatedTest/prototypes.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,3 +107,36 @@ class Derived2 {}
107107
Derived2.prototype = Object.create(Base.prototype);
108108
/** name:Derived2.read */
109109
Derived2.prototype.read = function() {};
110+
111+
112+
/** name:BanClass.tmpClass */
113+
function tmpClass() {}
114+
115+
function callerClass() {
116+
/** calls:BanClass.tmpClass */
117+
this.tmpClass();
118+
}
119+
class BanClass {
120+
constructor() {
121+
this.tmpClass = tmpClass;
122+
this.callerClass = callerClass;
123+
}
124+
}
125+
126+
/** name:BanProtytpe.tmpPrototype */
127+
function tmpPrototype() {}
128+
129+
function callerPrototype() {
130+
/** calls:BanProtytpe.tmpPrototype */
131+
this.tmpPrototype();
132+
}
133+
134+
function BanProtytpe() {
135+
this.tmpPrototype = tmpPrototype;
136+
this.callerPrototype = callerPrototype;
137+
}
138+
139+
function banInstantiation(){
140+
const instance = new BanProtytpe();
141+
instance.callerPrototype();
142+
}

0 commit comments

Comments
 (0)