Merge pull request #4987 from erik-krogh/defensiveFunctions

Approved by esbena
This commit is contained in:
CodeQL CI
2021-02-02 14:47:23 -08:00
committed by GitHub
3 changed files with 12 additions and 0 deletions

View File

@@ -51,5 +51,8 @@ where
or
// too benign in practice
e instanceof DefensiveExpressionTest::DefensiveInit
or
// functions might be written overly general
e.getALocalSource() instanceof DataFlow::ParameterNode
)
select e, "This guard always evaluates to " + cv + "."

View File

@@ -176,4 +176,11 @@
u && (u.p, f()); // technically not OK, but it seems like an unlikely pattern
u && !u.p; // NOT OK
u && !u(); // NOT OK
function hasCallbacks(success, error) {
if (success) success()
if (error) error()
}
hasCallbacks(() => {}, null);
});