JS: Add test

This commit is contained in:
Asger Feldthaus
2020-06-12 09:54:53 +01:00
parent b841cacb83
commit 6531db3cca
3 changed files with 35 additions and 1 deletions

View File

@@ -2,4 +2,5 @@ spuriousCallee
missingCallee
| constructor-field.ts:40:5:40:14 | f3.build() | constructor-field.ts:13:3:13:12 | build() {} | -1 |
| constructor-field.ts:71:1:71:11 | bf3.build() | constructor-field.ts:13:3:13:12 | build() {} | -1 |
| returned-function.js:23:1:23:4 | r2() | returned-function.js:8:9:10:9 | functio ... } | -1 |
badAnnotation

View File

@@ -66,7 +66,8 @@ query predicate missingCallee(AnnotatedCall call, AnnotatedFunction target, int
query predicate badAnnotation(string name) {
name = any(AnnotatedCall cl).getCallTargetName() and
not name = any(AnnotatedFunction cl).getCalleeName()
not name = any(AnnotatedFunction cl).getCalleeName() and
name != "NONE"
or
not name = any(AnnotatedCall cl).getCallTargetName() and
name = any(AnnotatedFunction cl).getCalleeName()

View File

@@ -0,0 +1,32 @@
import 'dummy';
/** name:curry1 */
function curry1() {
/** name:curry2 */
function curry2(x) {
/** name:curry3 */
function curry3(y) {
}
return curry3;
}
return curry2;
};
/** calls:curry1 */
let r1 = curry1();
/** calls:curry2 */
let r2 = r1();
/** calls:curry3 */
r2();
function callback(f) {
// Call graph should not include callback invocations.
/** calls:NONE */
f();
}
let w1 = callback(curry1);
callback(() => {});