JS: IllegalInvocation regression test

This commit is contained in:
Asger F
2019-09-08 15:45:11 +01:00
parent d3f587c12a
commit ad8667d6db
2 changed files with 9 additions and 0 deletions

View File

@@ -6,3 +6,4 @@
| 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

@@ -53,4 +53,12 @@ class E {
E.call(); // OK
E.apply(); // OK
function invoke(fn) {
if (typeof fn === "function" && fn.hasOwnProperty("foo")) {
fn(); // OK
}
}
invoke(C);
invoke(function() {});
//semmle-extractor-options: --experimental