JS: IllegalInvocation: be more convservative

This commit is contained in:
Asger F
2019-09-08 15:58:49 +01:00
parent ad8667d6db
commit 07df479b94
3 changed files with 6 additions and 7 deletions

View File

@@ -1,9 +1,6 @@
| tst.js:12:1:12:3 | C() | Illegal invocation of $@ as a function. | tst.js:1:9:1:8 | () {} | a constructor |
| tst.js:13:1:13:10 | new (x=>x) | Illegal invocation of $@ using 'new'. | tst.js:13:6:13:9 | x=>x | an arrow function |
| tst.js:15:1:15:9 | new c.m() | Illegal invocation of $@ using 'new'. | tst.js:2:4:2:8 | () {} | a method |
| tst.js:24:1:24:9 | new o.g() | Illegal invocation of $@ using 'new'. | tst.js:19:4:19:8 | () {} | a method |
| tst.js:42:1:42:7 | new g() | Illegal invocation of $@ using 'new'. | tst.js:39:1:39:16 | function* g() {} | a generator function |
| tst.js:43:1:43:7 | new h() | Illegal invocation of $@ using 'new'. | tst.js:40:1:40:21 | async f ... h() {} | an async function |
| tst.js:45:1:45:8 | reflective call | Illegal invocation of $@ as a function. | tst.js:1:9:1:8 | () {} | a constructor |
| tst.js:46:1:46:9 | reflective call | Illegal invocation of $@ as a function. | tst.js:1:9:1:8 | () {} | a constructor |
| tst.js:50:5:50:8 | fn() | Illegal invocation of $@ as a function. | tst.js:1:9:1:8 | () {} | a constructor |

View File

@@ -12,7 +12,7 @@ let c = new C(); // OK
C(); // NOT OK
new (x=>x); // NOT OK
c.m(); // OK
new c.m(); // NOT OK
new c.m(); // NOT OK - but not flagged
var o = {
f: function() {},
@@ -21,7 +21,7 @@ var o = {
o.f(); // OK
new o.f(); // OK
o.g(); // OK
new o.g(); // NOT OK
new o.g(); // NOT OK - but not flagged
function f(b) {
var g;
@@ -61,4 +61,4 @@ function invoke(fn) {
invoke(C);
invoke(function() {});
//semmle-extractor-options: --experimental
//semmle-extractor-options: --experimental