mirror of
https://github.com/github/codeql.git
synced 2026-03-29 11:48:16 +02:00
This fixes false positives that arise when a call such as `f.apply` can either be interpreted as a reflective invocation of `f`, or a normal call to method `apply` of `f`.
57 lines
807 B
JavaScript
57 lines
807 B
JavaScript
class C {
|
|
m() {}
|
|
}
|
|
|
|
class D extends C {
|
|
constructor() {
|
|
super(); // OK
|
|
}
|
|
}
|
|
|
|
let c = new C(); // OK
|
|
C(); // NOT OK
|
|
new (x=>x); // NOT OK
|
|
c.m(); // OK
|
|
new c.m(); // NOT OK
|
|
|
|
var o = {
|
|
f: function() {},
|
|
g() {}
|
|
};
|
|
o.f(); // OK
|
|
new o.f(); // OK
|
|
o.g(); // OK
|
|
new o.g(); // NOT OK
|
|
|
|
function f(b) {
|
|
var g;
|
|
if (b)
|
|
g = class {};
|
|
else
|
|
g = (() => {});
|
|
console.log();
|
|
if (!b)
|
|
g(); // OK
|
|
else
|
|
new g(); // OK
|
|
}
|
|
|
|
function* g() {}
|
|
async function h() {}
|
|
|
|
new g() // NOT OK
|
|
new h() // NOT OK
|
|
|
|
C.call(); // NOT OK
|
|
C.apply(); // NOT OK
|
|
|
|
class E {
|
|
static call() {}
|
|
static apply() {}
|
|
}
|
|
|
|
E.call(); // OK
|
|
E.apply(); // OK
|
|
|
|
//semmle-extractor-options: --experimental
|