Skip to content

Commit a015003

Browse files
committed
Updated test case to resolve reflected calls
1 parent 4fbf8ca commit a015003

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ 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 |
55
| prototypes.js:7:5:7:16 | this.greet() | prototypes.js:59:8:63:3 | () { \\n ... ); \\n } | -1 | calls |
6-
| prototypes.js:62:5:62:34 | Baz.pro ... l(this) | prototypes.js:10:8:10:39 | () { co ... et"); } | -1 | calls |
7-
| prototypes.js:77:3:77:32 | Baz.pro ... l(this) | prototypes.js:14:23:14:62 | functio ... ut"); } | -1 | calls |
86
badAnnotation
97
accessorCall
108
| accessors.js:12:1:12:5 | obj.f | accessors.js:5:8:5:12 | () {} |

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

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class AnnotatedCall extends DataFlow::Node {
3131

3232
AnnotatedCall() {
3333
this instanceof DataFlow::InvokeNode and
34-
calls = getAnnotation(this.asExpr(), kind) and
34+
calls = getAnnotation(this.getEnclosingExpr(), kind) and
3535
kind = "calls"
3636
or
3737
this instanceof DataFlow::PropRef and
@@ -79,12 +79,14 @@ query predicate spuriousCallee(AnnotatedCall call, Function target, int boundArg
7979
}
8080

8181
query predicate missingCallee(
82-
AnnotatedCall call, AnnotatedFunction target, int boundArgs, string kind
82+
InvokeExpr invoke, AnnotatedFunction target, int boundArgs, string kind
8383
) {
84-
not callEdge(call, target, boundArgs) and
85-
kind = call.getKind() and
86-
target = call.getAnExpectedCallee(kind) and
87-
boundArgs = call.getBoundArgsOrMinusOne()
84+
forex(AnnotatedCall call | call.getEnclosingExpr() = invoke |
85+
not callEdge(call, target, boundArgs) and
86+
kind = call.getKind() and
87+
target = call.getAnExpectedCallee(kind) and
88+
boundArgs = call.getBoundArgsOrMinusOne()
89+
)
8890
}
8991

9092
query predicate badAnnotation(string name) {

0 commit comments

Comments
 (0)