Updated test case to resolve reflected calls

This commit is contained in:
Napalys Klicius
2025-04-29 12:32:26 +02:00
parent 4fbf8ca5cf
commit a015003bda
2 changed files with 8 additions and 8 deletions

View File

@@ -3,8 +3,6 @@ missingCallee
| constructor-field.ts:40:5:40:14 | f3.build() | constructor-field.ts:13:3:13:12 | build() {} | -1 | calls |
| constructor-field.ts:71:1:71:11 | bf3.build() | constructor-field.ts:13:3:13:12 | build() {} | -1 | calls |
| prototypes.js:7:5:7:16 | this.greet() | prototypes.js:59:8:63:3 | () { \\n ... ); \\n } | -1 | calls |
| prototypes.js:62:5:62:34 | Baz.pro ... l(this) | prototypes.js:10:8:10:39 | () { co ... et"); } | -1 | calls |
| prototypes.js:77:3:77:32 | Baz.pro ... l(this) | prototypes.js:14:23:14:62 | functio ... ut"); } | -1 | calls |
badAnnotation
accessorCall
| accessors.js:12:1:12:5 | obj.f | accessors.js:5:8:5:12 | () {} |

View File

@@ -31,7 +31,7 @@ class AnnotatedCall extends DataFlow::Node {
AnnotatedCall() {
this instanceof DataFlow::InvokeNode and
calls = getAnnotation(this.asExpr(), kind) and
calls = getAnnotation(this.getEnclosingExpr(), kind) and
kind = "calls"
or
this instanceof DataFlow::PropRef and
@@ -79,12 +79,14 @@ query predicate spuriousCallee(AnnotatedCall call, Function target, int boundArg
}
query predicate missingCallee(
AnnotatedCall call, AnnotatedFunction target, int boundArgs, string kind
InvokeExpr invoke, AnnotatedFunction target, int boundArgs, string kind
) {
not callEdge(call, target, boundArgs) and
kind = call.getKind() and
target = call.getAnExpectedCallee(kind) and
boundArgs = call.getBoundArgsOrMinusOne()
forex(AnnotatedCall call | call.getEnclosingExpr() = invoke |
not callEdge(call, target, boundArgs) and
kind = call.getKind() and
target = call.getAnExpectedCallee(kind) and
boundArgs = call.getBoundArgsOrMinusOne()
)
}
query predicate badAnnotation(string name) {